+++ /dev/null
-#
-# Azure Pipelines "auto" branch build for Rust on Linux, macOS, and Windows.
-#
-
-pr: none
-trigger:
- - auto
-
-variables:
-- group: real-prod-credentials
-
-jobs:
-- job: Linux
- timeoutInMinutes: 600
- pool:
- vmImage: ubuntu-16.04
- steps:
- - template: steps/run.yml
- strategy:
- matrix:
- x86_64-gnu-llvm-6.0:
- IMAGE: x86_64-gnu-llvm-6.0
- RUST_BACKTRACE: 1
-
- dist-x86_64-linux:
- IMAGE: dist-x86_64-linux
- DEPLOY: 1
-
- # "alternate" deployments, these are "nightlies" but have LLVM assertions
- # turned on, they're deployed to a different location primarily for
- # additional testing.
- dist-x86_64-linux-alt:
- IMAGE: dist-x86_64-linux
- DEPLOY_ALT: 1
-
- # Linux builders, remaining docker images
- arm-android:
- IMAGE: arm-android
-
- armhf-gnu:
- IMAGE: armhf-gnu
-
- dist-various-1:
- IMAGE: dist-various-1
- DEPLOY: 1
-
- dist-various-2:
- IMAGE: dist-various-2
- DEPLOY: 1
-
- dist-aarch64-linux:
- IMAGE: dist-aarch64-linux
- DEPLOY: 1
-
- dist-android:
- IMAGE: dist-android
- DEPLOY: 1
-
- dist-arm-linux:
- IMAGE: dist-arm-linux
- DEPLOY: 1
-
- dist-armhf-linux:
- IMAGE: dist-armhf-linux
- DEPLOY: 1
-
- dist-armv7-linux:
- IMAGE: dist-armv7-linux
- DEPLOY: 1
-
- dist-i586-gnu-i586-i686-musl:
- IMAGE: dist-i586-gnu-i586-i686-musl
- DEPLOY: 1
-
- dist-i686-freebsd:
- IMAGE: dist-i686-freebsd
- DEPLOY: 1
-
- dist-i686-linux:
- IMAGE: dist-i686-linux
- DEPLOY: 1
-
- dist-mips-linux:
- IMAGE: dist-mips-linux
- DEPLOY: 1
-
- dist-mips64-linux:
- IMAGE: dist-mips64-linux
- DEPLOY: 1
-
- dist-mips64el-linux:
- IMAGE: dist-mips64el-linux
- DEPLOY: 1
-
- dist-mipsel-linux:
- IMAGE: dist-mipsel-linux
- DEPLOY: 1
-
- dist-powerpc-linux:
- IMAGE: dist-powerpc-linux
- DEPLOY: 1
-
- dist-powerpc64-linux:
- IMAGE: dist-powerpc64-linux
- DEPLOY: 1
-
- dist-powerpc64le-linux:
- IMAGE: dist-powerpc64le-linux
- DEPLOY: 1
-
- dist-s390x-linux:
- IMAGE: dist-s390x-linux
- DEPLOY: 1
-
- dist-x86_64-freebsd:
- IMAGE: dist-x86_64-freebsd
- DEPLOY: 1
-
- dist-x86_64-musl:
- IMAGE: dist-x86_64-musl
- DEPLOY: 1
-
- dist-x86_64-netbsd:
- IMAGE: dist-x86_64-netbsd
- DEPLOY: 1
-
- asmjs:
- IMAGE: asmjs
- i686-gnu:
- IMAGE: i686-gnu
- i686-gnu-nopt:
- IMAGE: i686-gnu-nopt
- test-various:
- IMAGE: test-various
- x86_64-gnu:
- IMAGE: x86_64-gnu
- x86_64-gnu-full-bootstrap:
- IMAGE: x86_64-gnu-full-bootstrap
- x86_64-gnu-aux:
- IMAGE: x86_64-gnu-aux
- x86_64-gnu-tools:
- IMAGE: x86_64-gnu-tools
- x86_64-gnu-debug:
- IMAGE: x86_64-gnu-debug
- x86_64-gnu-nopt:
- IMAGE: x86_64-gnu-nopt
- x86_64-gnu-distcheck:
- IMAGE: x86_64-gnu-distcheck
- mingw-check:
- IMAGE: mingw-check
-
-- job: macOS
- timeoutInMinutes: 600
- pool:
- vmImage: macos-10.13
- steps:
- - template: steps/run.yml
- strategy:
- matrix:
- # OSX builders running tests, these run the full test suite.
- # NO_DEBUG_ASSERTIONS=1 to make them go faster, but also do have some
- # runners that run `//ignore-debug` tests.
- #
- # Note that the compiler is compiled to target 10.8 here because the Xcode
- # version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
- x86_64-apple:
- SCRIPT: ./x.py test
- RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
- RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
- MACOSX_DEPLOYMENT_TARGET: 10.8
- MACOSX_STD_DEPLOYMENT_TARGET: 10.7
- NO_LLVM_ASSERTIONS: 1
- NO_DEBUG_ASSERTIONS: 1
-
- dist-x86_64-apple:
- SCRIPT: ./x.py dist
- RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
- DEPLOY: 1
- RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
- MACOSX_DEPLOYMENT_TARGET: 10.7
- NO_LLVM_ASSERTIONS: 1
- NO_DEBUG_ASSERTIONS: 1
- DIST_REQUIRE_ALL_TOOLS: 1
-
- dist-x86_64-apple-alt:
- SCRIPT: ./x.py dist
- RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
- DEPLOY_ALT: 1
- RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
- MACOSX_DEPLOYMENT_TARGET: 10.7
- NO_LLVM_ASSERTIONS: 1
- NO_DEBUG_ASSERTIONS: 1
-
- i686-apple:
- SCRIPT: ./x.py test
- RUST_CONFIGURE_ARGS: --build=i686-apple-darwin --set rust.jemalloc
- RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
- MACOSX_DEPLOYMENT_TARGET: 10.8
- MACOSX_STD_DEPLOYMENT_TARGET: 10.7
- NO_LLVM_ASSERTIONS: 1
- NO_DEBUG_ASSERTIONS: 1
-
- dist-i686-apple:
- SCRIPT: ./x.py dist
- RUST_CONFIGURE_ARGS: --build=i686-apple-darwin --enable-full-tools --enable-profiler --set rust.jemalloc
- DEPLOY: 1
- RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
- MACOSX_DEPLOYMENT_TARGET: 10.7
- NO_LLVM_ASSERTIONS: 1
- NO_DEBUG_ASSERTIONS: 1
- DIST_REQUIRE_ALL_TOOLS: 1
-
-
-
-- job: Windows
- timeoutInMinutes: 600
- pool:
- vmImage: 'vs2017-win2016'
- steps:
- - template: steps/run.yml
- strategy:
- matrix:
- # 32/64 bit MSVC tests
- x86_64-msvc-1:
- MSYS_BITS: 64
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
- SCRIPT: make ci-subset-1
- # FIXME(#59637)
- NO_DEBUG_ASSERTIONS: 1
- NO_LLVM_ASSERTIONS: 1
- x86_64-msvc-2:
- MSYS_BITS: 64
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
- SCRIPT: make ci-subset-2
- i686-msvc-1:
- MSYS_BITS: 32
- RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
- SCRIPT: make ci-subset-1
- i686-msvc-2:
- MSYS_BITS: 32
- RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
- SCRIPT: make ci-subset-2
- # MSVC aux tests
- x86_64-msvc-aux:
- MSYS_BITS: 64
- RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
- x86_64-msvc-cargo:
- MSYS_BITS: 64
- SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
- VCVARS_BAT: vcvars64.bat
- # MSVC tools tests
- x86_64-msvc-tools:
- MSYS_BITS: 64
- SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json --enable-test-miri
-
- # 32/64-bit MinGW builds.
- #
- # We are using MinGW with posix threads since LLVM does not compile with
- # the win32 threads version due to missing support for C++'s std::thread.
- #
- # Instead of relying on the MinGW version installed on appveryor we download
- # and install one ourselves so we won't be surprised by changes to appveyor's
- # build image.
- #
- # Finally, note that the downloads below are all in the `rust-lang-ci` S3
- # bucket, but they cleraly didn't originate there! The downloads originally
- # came from the mingw-w64 SourceForge download site. Unfortunately
- # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
- i686-mingw-1:
- MSYS_BITS: 32
- RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
- SCRIPT: make ci-subset-1
- MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
- MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
- MINGW_DIR: mingw32
- # FIXME(#59637)
- NO_DEBUG_ASSERTIONS: 1
- NO_LLVM_ASSERTIONS: 1
- i686-mingw-2:
- MSYS_BITS: 32
- RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
- SCRIPT: make ci-subset-2
- MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
- MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
- MINGW_DIR: mingw32
- x86_64-mingw-1:
- MSYS_BITS: 64
- SCRIPT: make ci-subset-1
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
- MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
- MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
- MINGW_DIR: mingw64
- # FIXME(#59637)
- NO_DEBUG_ASSERTIONS: 1
- NO_LLVM_ASSERTIONS: 1
- x86_64-mingw-2:
- MSYS_BITS: 64
- SCRIPT: make ci-subset-2
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
- MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
- MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
- MINGW_DIR: mingw64
-
- # 32/64 bit MSVC and GNU deployment
- dist-x86_64-msvc:
- RUST_CONFIGURE_ARGS: >
- --build=x86_64-pc-windows-msvc
- --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
- --enable-full-tools
- --enable-profiler
- SCRIPT: python x.py dist
- DIST_REQUIRE_ALL_TOOLS: 1
- DEPLOY: 1
- dist-i686-msvc:
- RUST_CONFIGURE_ARGS: >
- --build=i686-pc-windows-msvc
- --target=i586-pc-windows-msvc
- --enable-full-tools
- --enable-profiler
- SCRIPT: python x.py dist
- DIST_REQUIRE_ALL_TOOLS: 1
- DEPLOY: 1
- dist-i686-mingw:
- MSYS_BITS: 32
- RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
- SCRIPT: python x.py dist
- MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
- MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
- MINGW_DIR: mingw32
- DIST_REQUIRE_ALL_TOOLS: 1
- DEPLOY: 1
- dist-x86_64-mingw:
- MSYS_BITS: 64
- SCRIPT: python x.py dist
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
- MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
- MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
- MINGW_DIR: mingw64
- DIST_REQUIRE_ALL_TOOLS: 1
- DEPLOY: 1
-
- # "alternate" deployment, see .travis.yml for more info
- dist-x86_64-msvc-alt:
- MSYS_BITS: 64
- RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
- SCRIPT: python x.py dist
- DEPLOY_ALT: 1
+++ /dev/null
-#
-# Azure Pipelines job to publish toolstate. Only triggers on pushes to master.
-#
-
-pr: none
-trigger:
- - master
-
-variables:
-- group: real-prod-credentials
-
-pool:
- vmImage: ubuntu-16.04
-
-steps:
-- checkout: self
- fetchDepth: 2
-
-- script: |
- export MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
- . src/ci/docker/x86_64-gnu-tools/repo.sh
- commit_toolstate_change "$MESSAGE_FILE" "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "$MESSAGE_FILE" "$TOOLSTATE_REPO_ACCESS_TOKEN"
- displayName: Publish toolstate
- env:
- TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
+++ /dev/null
-#
-# Azure Pipelines pull request build for Rust
-#
-
-trigger: none
-pr:
-- master
-
-variables:
-- group: public-credentials
-
-jobs:
-- job: Linux
- timeoutInMinutes: 600
- pool:
- vmImage: ubuntu-16.04
- steps:
- - template: steps/run.yml
- strategy:
- matrix:
- x86_64-gnu-llvm-6.0:
- IMAGE: x86_64-gnu-llvm-6.0
- mingw-check:
- IMAGE: mingw-check
-
-- job: LinuxTools
- timeoutInMinutes: 600
- pool:
- vmImage: ubuntu-16.04
- steps:
- - template: steps/run.yml
- parameters:
- only_on_updated_submodules: 'yes'
- variables:
- IMAGE: x86_64-gnu-tools
+++ /dev/null
-steps:
-
-- bash: |
- set -e
- curl -f http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz | tar xJf -
-
- export CC=`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang
- echo "##vso[task.setvariable variable=CC]$CC"
-
- export CXX=`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang++
- echo "##vso[task.setvariable variable=CXX]$CXX"
-
- # Configure `AR` specifically so rustbuild doesn't try to infer it as
- # `clang-ar` by accident.
- echo "##vso[task.setvariable variable=AR]ar"
- displayName: Install clang (OSX)
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
-
-# If we're compiling for MSVC then we, like most other distribution builders,
-# switch to clang as the compiler. This'll allow us eventually to enable LTO
-# amongst LLVM and rustc. Note that we only do this on MSVC as I don't think
-# clang has an output mode compatible with MinGW that we need. If it does we
-# should switch to clang for MinGW as well!
-#
-# Note that the LLVM installer is an NSIS installer
-#
-# Original downloaded here came from
-# http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe
-# That installer was run through `wine` on Linux and then the resulting
-# installation directory (found in `$HOME/.wine/drive_c/Program Files/LLVM`) was
-# packaged up into a tarball. We've had issues otherwise that the installer will
-# randomly hang, provide not a lot of useful information, pollute global state,
-# etc. In general the tarball is just more confined and easier to deal with when
-# working with various CI environments.
-- bash: |
- set -e
- mkdir -p citools
- cd citools
- curl -f https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-7.0.0-win64.tar.gz | tar xzf -
- echo "##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]$RUST_CONFIGURE_ARGS --set llvm.clang-cl=`pwd`/clang-rust/bin/clang-cl.exe"
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
- displayName: Install clang (Windows)
-
-# Note that we don't install clang on Linux since its compiler story is just so
-# different. Each container has its own toolchain configured appropriately
-# already.
+++ /dev/null
-steps:
-
-- bash: |
- set -e
- curl -fo /usr/local/bin/sccache https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2018-04-02-sccache-x86_64-apple-darwin
- chmod +x /usr/local/bin/sccache
- displayName: Install sccache (OSX)
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
-
-- script: |
- md sccache
- powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf sccache\sccache.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2018-04-26-sccache-x86_64-pc-windows-msvc"
- echo ##vso[task.prependpath]%CD%\sccache
- displayName: Install sccache (Windows)
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
-
-# Note that we don't install sccache on Linux since it's installed elsewhere
-# through all the containers.
-#
-# FIXME: we should probably install sccache outside the containers and then
-# mount it inside the containers so we can centralize all installation here.
+++ /dev/null
-steps:
-# We use the WIX toolset to create combined installers for Windows, and these
-# binaries are downloaded from
-# https://github.com/wixtoolset/wix3 originally
-- bash: |
- set -e
- curl -O https://rust-lang-ci2.s3-us-west-1.amazonaws.com/rust-ci-mirror/wix311-binaries.zip
- echo "##vso[task.setvariable variable=WIX]`pwd`/wix"
- mkdir -p wix/bin
- cd wix/bin
- 7z x ../../wix311-binaries.zip
- displayName: Install wix
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
-
-# We use InnoSetup and its `iscc` program to also create combined installers.
-# Honestly at this point WIX above and `iscc` are just holdovers from
-# oh-so-long-ago and are required for creating installers on Windows. I think
-# one is MSI installers and one is EXE, but they're not used so frequently at
-# this point anyway so perhaps it's a wash!
-- script: |
- powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf is-install.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2017-08-22-is.exe"
- is-install.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
- echo ##vso[task.prependpath]C:\Program Files (x86)\Inno Setup 5
- displayName: Install InnoSetup
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
-
-# We've had issues with the default drive in use running out of space during a
-# build, and it looks like the `C:` drive has more space than the default `D:`
-# drive. We should probably confirm this with the azure pipelines team at some
-# point, but this seems to fix our "disk space full" problems.
-- script: |
- mkdir c:\MORE_SPACE
- mklink /J build c:\MORE_SPACE
- displayName: "Ensure build happens on C:/ instead of D:/"
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
-
-- bash: git config --replace-all --global core.autocrlf false
- displayName: "Disable git automatic line ending conversion (on C:/)"
-
-# Download and install MSYS2, needed primarily for the test suite (run-make) but
-# also used by the MinGW toolchain for assembling things.
-#
-# FIXME: we should probe the default azure image and see if we can use the MSYS2
-# toolchain there. (if there's even one there). For now though this gets the job
-# done.
-- script: |
- set MSYS_PATH=%CD%\citools\msys64
- choco install msys2 --params="/InstallDir:%MSYS_PATH% /NoPath" -y
- set PATH=%MSYS_PATH%\usr\bin;%PATH%
- pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
- IF "%MINGW_URL%"=="" (
- IF "%MSYS_BITS%"=="32" pacman -S --noconfirm --needed mingw-w64-i686-toolchain mingw-w64-i686-cmake mingw-w64-i686-gcc mingw-w64-i686-python2
- IF "%MSYS_BITS%"=="64" pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-python2
- )
- where rev
- rev --help
- where make
-
- echo ##vso[task.setvariable variable=MSYS_PATH]%MSYS_PATH%
- echo ##vso[task.prependpath]%MSYS_PATH%\usr\bin
- displayName: Install msys2
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
-
-# If we need to download a custom MinGW, do so here and set the path
-# appropriately.
-#
-# Here we also do a pretty heinous thing which is to mangle the MinGW
-# installation we just downloaded. Currently, as of this writing, we're using
-# MinGW-w64 builds of gcc, and that's currently at 6.3.0. We use 6.3.0 as it
-# appears to be the first version which contains a fix for #40546, builds
-# randomly failing during LLVM due to ar.exe/ranlib.exe failures.
-#
-# Unfortunately, though, 6.3.0 *also* is the first version of MinGW-w64 builds
-# to contain a regression in gdb (#40184). As a result if we were to use the
-# gdb provided (7.11.1) then we would fail all debuginfo tests.
-#
-# In order to fix spurious failures (pretty high priority) we use 6.3.0. To
-# avoid disabling gdb tests we download an *old* version of gdb, specifically
-# that found inside the 6.2.0 distribution. We then overwrite the 6.3.0 gdb
-# with the 6.2.0 gdb to get tests passing.
-#
-# Note that we don't literally overwrite the gdb.exe binary because it appears
-# to just use gdborig.exe, so that's the binary we deal with instead.
-- script: |
- powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %MINGW_ARCHIVE% %MINGW_URL%/%MINGW_ARCHIVE%"
- 7z x -y %MINGW_ARCHIVE% > nul
- powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_URL%/2017-04-20-%MSYS_BITS%bit-gdborig.exe"
- mv 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_DIR%\bin\gdborig.exe
- echo ##vso[task.prependpath]%CD%\%MINGW_DIR%\bin
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['MINGW_URL'],''))
- displayName: Download custom MinGW
-
-# Otherwise pull in the MinGW installed on appveyor
-- script: |
- echo ##vso[task.prependpath]%MSYS_PATH%\mingw%MSYS_BITS%\bin
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
- displayName: Add MinGW to path
-
-# Make sure we use the native python interpreter instead of some msys equivalent
-# one way or another. The msys interpreters seem to have weird path conversions
-# baked in which break LLVM's build system one way or another, so let's use the
-# native version which keeps everything as native as possible.
-- script: |
- copy C:\Python27amd64\python.exe C:\Python27amd64\python2.7.exe
- echo ##vso[task.prependpath]C:\Python27amd64
- displayName: Prefer the "native" Python as LLVM has trouble building with MSYS sometimes
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
-
-# Note that this is originally from the github releases patch of Ninja
-- script: |
- md ninja
- powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-03-15-ninja-win.zip https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2017-03-15-ninja-win.zip"
- 7z x -oninja 2017-03-15-ninja-win.zip
- del 2017-03-15-ninja-win.zip
- set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja
- echo ##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]%RUST_CONFIGURE_ARGS%
- echo ##vso[task.prependpath]%CD%\ninja
- displayName: Download and install ninja
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+++ /dev/null
-# FIXME(linux): need to configure core dumps, enable them, and then dump
-# backtraces on failure from all core dumps:
-#
-# - bash: sudo apt install gdb
-# - bash: sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern'
-#
-# Check travis config for `gdb --batch` command to print all crash logs
-
-parameters:
- # When this parameter is set to anything other than an empty string the tests
- # will only be executed when the commit updates submodules
- only_on_updated_submodules: ''
-
-steps:
-
-# Disable automatic line ending conversion, which is enabled by default on
-# Azure's Windows image. Having the conversion enabled caused regressions both
-# in our test suite (it broke miri tests) and in the ecosystem, since we
-# started shipping install scripts with CRLF endings instead of the old LF.
-#
-# Note that we do this a couple times during the build as the PATH and current
-# user/directory change, e.g. when mingw is enabled.
-- bash: git config --global core.autocrlf false
- displayName: "Disable git automatic line ending conversion"
-
-- checkout: self
- fetchDepth: 2
-
-# Set the SKIP_JOB environment variable if this job is supposed to only run
-# when submodules are updated and they were not. The following time consuming
-# tasks will be skipped when the environment variable is present.
-- ${{ if parameters.only_on_updated_submodules }}:
- - bash: |
- set -e
- # Submodules pseudo-files inside git have the 160000 permissions, so when
- # those files are present in the diff a submodule was updated.
- if git diff HEAD^ | grep "^index .* 160000" >/dev/null 2>&1; then
- echo "Executing the job since submodules are updated"
- else
- echo "Not executing this job since no submodules were updated"
- echo "##vso[task.setvariable variable=SKIP_JOB;]1"
- fi
- displayName: Decide whether to run this job
-
-# Spawn a background process to collect CPU usage statistics which we'll upload
-# at the end of the build. See the comments in the script here for more
-# information.
-- bash: python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
- displayName: "Collect CPU-usage statistics in the background"
-
-- bash: printenv | sort
- displayName: Show environment variables
-
-- bash: |
- set -e
- df -h
- du . | sort -nr | head -n100
- displayName: Show disk usage
- # FIXME: this hasn't been tested, but maybe it works on Windows? Should test!
- condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
-
-- template: install-sccache.yml
-- template: install-clang.yml
-
-# Switch to XCode 9.3 on OSX since it seems to be the last version that supports
-# i686-apple-darwin. We'll eventually want to upgrade this and it will probably
-# force us to drop i686-apple-darwin, but let's keep the wheels turning for now.
-- bash: |
- set -e
- sudo xcode-select --switch /Applications/Xcode_9.3.app
- displayName: Switch to Xcode 9.3 (OSX)
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
-
-- template: install-windows-build-deps.yml
-
-# Looks like docker containers have IPv6 disabled by default, so let's turn it
-# on since libstd tests require it
-- bash: |
- set -e
- sudo mkdir -p /etc/docker
- echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart
- displayName: Enable IPv6
- condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
-
-# Disable automatic line ending conversion (again). On Windows, when we're
-# installing dependencies, something switches the git configuration directory or
-# re-enables autocrlf. We've not tracked down the exact cause -- and there may
-# be multiple -- but this should ensure submodules are checked out with the
-# appropriate line endings.
-- bash: git config --replace-all --global core.autocrlf false
- displayName: "Disable git automatic line ending conversion"
-
-# Check out all our submodules, but more quickly than using git by using one of
-# our custom scripts
-- bash: |
- set -e
- mkdir -p $HOME/rustsrc
- $BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
- condition: and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Windows_NT'))
- displayName: Check out submodules (Unix)
-- script: |
- if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
- sh src/ci/init_repo.sh . /c/cache/rustsrc
- condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Windows_NT'))
- displayName: Check out submodules (Windows)
-
-# See also the disable for autocrlf above, this just checks that it worked
-#
-# We check both in rust-lang/rust and in a submodule to make sure both are
-# accurate. Submodules are checked out significantly later than the main
-# repository in this script, so settings can (and do!) change between then.
-#
-# Linux (and maybe macOS) builders don't currently have dos2unix so just only
-# run this step on Windows.
-- bash: |
- set -x
- # print out the git configuration so we can better investigate failures in
- # the following
- git config --list --show-origin
- dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
- endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
- # if endings has non-zero length, error out
- if [ -n "$endings" ]; then exit 1 ; fi
- condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
- displayName: Verify line endings are LF
-
-# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
-# images, etc.
-- bash: src/ci/install-awscli.sh
- env:
- AGENT_OS: $(Agent.OS)
- condition: and(succeeded(), not(variables.SKIP_JOB))
- displayName: Install awscli
-
-# Configure our CI_JOB_NAME variable which log analyzers can use for the main
-# step to see what's going on.
-- bash: |
- builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
- echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
- displayName: Configure Job Name
-
-# As a quick smoke check on the otherwise very fast mingw-check linux builder
-# check our own internal scripts.
-- bash: |
- set -e
- git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
- cd rust-toolstate
- python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
- cd ..
- rm -rf rust-toolstate
- condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
- displayName: Verify the publish_toolstate script works
-
-- bash: |
- set -e
- # Remove any preexisting rustup installation since it can interfere
- # with the cargotest step and its auto-detection of things like Clippy in
- # the environment
- rustup self uninstall -y || true
- if [ "$IMAGE" = "" ]; then
- src/ci/run.sh
- else
- src/ci/docker/run.sh $IMAGE
- fi
- #timeoutInMinutes: 180
- timeoutInMinutes: 600
- env:
- CI: true
- SRC: .
- AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
- TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
- condition: and(succeeded(), not(variables.SKIP_JOB))
- displayName: Run build
-
-# If we're a deploy builder, use the `aws` command to publish everything to our
-# bucket.
-- bash: |
- set -e
- source src/ci/shared.sh
- if [ "$AGENT_OS" = "Linux" ]; then
- rm -rf obj/build/dist/doc
- upload_dir=obj/build/dist
- else
- rm -rf build/dist/doc
- upload_dir=build/dist
- fi
- ls -la $upload_dir
- deploy_dir=rustc-builds
- if [ "$DEPLOY_ALT" == "1" ]; then
- deploy_dir=rustc-builds-alt
- fi
- retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
- env:
- AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
- condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
- displayName: Upload artifacts
-
-# Upload CPU usage statistics that we've been gathering this whole time. Always
-# execute this step in case we want to inspect failed builds, but don't let
-# errors here ever fail the build since this is just informational.
-- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
- env:
- AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
- condition: variables['AWS_SECRET_ACCESS_KEY']
- continueOnError: true
- displayName: Upload CPU usage statistics
+++ /dev/null
-pr: none
-trigger:
-- try
-
-variables:
-- group: real-prod-credentials
-
-jobs:
-- job: Linux
- timeoutInMinutes: 600
- pool:
- vmImage: ubuntu-16.04
- steps:
- - template: steps/run.yml
- strategy:
- matrix:
- dist-x86_64-linux:
- IMAGE: dist-x86_64-linux
- DEPLOY: 1
-
- dist-x86_64-linux-alt:
- IMAGE: dist-x86_64-linux
- DEPLOY_ALT: 1
-
-# The macOS and Windows builds here are currently disabled due to them not being
-# overly necessary on `try` builds. We also don't actually have anything that
-# consumes the artifacts currently. Perhaps one day we can reenable, but for now
-# it helps free up capacity on Azure.
-# - job: macOS
-# timeoutInMinutes: 600
-# pool:
-# vmImage: macos-10.13
-# steps:
-# - template: steps/run.yml
-# strategy:
-# matrix:
-# dist-x86_64-apple:
-# SCRIPT: ./x.py dist
-# RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
-# DEPLOY: 1
-# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
-# MACOSX_DEPLOYMENT_TARGET: 10.7
-# NO_LLVM_ASSERTIONS: 1
-# NO_DEBUG_ASSERTIONS: 1
-# DIST_REQUIRE_ALL_TOOLS: 1
-#
-# dist-x86_64-apple-alt:
-# SCRIPT: ./x.py dist
-# RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
-# DEPLOY_ALT: 1
-# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
-# MACOSX_DEPLOYMENT_TARGET: 10.7
-# NO_LLVM_ASSERTIONS: 1
-# NO_DEBUG_ASSERTIONS: 1
-#
-# - job: Windows
-# timeoutInMinutes: 600
-# pool:
-# vmImage: 'vs2017-win2016'
-# steps:
-# - template: steps/run.yml
-# strategy:
-# matrix:
-# dist-x86_64-msvc:
-# RUST_CONFIGURE_ARGS: >
-# --build=x86_64-pc-windows-msvc
-# --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
-# --enable-full-tools
-# --enable-profiler
-# SCRIPT: python x.py dist
-# DIST_REQUIRE_ALL_TOOLS: 1
-# DEPLOY: 1
-#
-# dist-x86_64-msvc-alt:
-# MSYS_BITS: 64
-# RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
-# SCRIPT: python x.py dist
-# DEPLOY_ALT: 1
[[package]]
name = "racer"
-version = "2.1.24"
+version = "2.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.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.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
"lsp-types 0.57.2 (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.24 (registry+https://github.com/rust-lang/crates.io-index)",
+ "racer 2.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.6 (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.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustfmt-nightly 1.4.1",
+ "rustfmt-nightly 1.4.3",
"serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]]
name = "rustc-ap-arena"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "rustc-ap-rustc_data_structures 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-ap-graphviz"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc-ap-rustc_data_structures"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.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.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-graphviz 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-graphviz 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 546.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.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]]
name = "rustc-ap-rustc_errors"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"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_data_structures 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax_pos 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax_pos 546.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_lexer"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc-ap-rustc_macros"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]]
name = "rustc-ap-rustc_target"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (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 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax_pos 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-ap-serialize"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
[[package]]
name = "rustc-ap-syntax"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (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 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_errors 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_lexer 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_macros 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_target 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax_pos 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_errors 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_lexer 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_macros 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_target 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-ap-syntax_pos"
-version = "542.0.0"
+version = "546.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-arena 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_data_structures 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_macros 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-serialize 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-arena 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_macros 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 1.0.0 (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 = "rustfmt-nightly"
-version = "1.4.1"
+version = "1.4.3"
dependencies = [
"annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.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.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-rustc_target 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-ap-syntax_pos 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-rustc_target 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-workspace-hack 1.0.0",
"rustfmt-config_proc_macro 0.1.2",
"serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
"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.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
-"checksum racer 2.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "19cfa87290af63a309db9a0363edb89fb8ed9a1ead92285985662b9f54927fa3"
+"checksum racer 2.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "0727b9d7baaf9e42851145545d7b980b5c1752bd16a4c77c925c5e573d0069d9"
"checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a"
"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c"
"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a"
"checksum rls-data 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "76c72ea97e045be5f6290bb157ebdc5ee9f2b093831ff72adfaf59025cf5c491"
"checksum rls-span 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f1cb4694410d8d2ce43ccff3682f1c782158a018d5a9a92185675677f7533eb3"
"checksum rls-vfs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce4b57b25b4330ed5ec14028fc02141e083ddafda327e7eb598dc0569c8c83c9"
-"checksum rustc-ap-arena 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60ae3caf12a5dfa3181e12e813b090b0b41d43b91b193759ba9084520aeb2459"
-"checksum rustc-ap-graphviz 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0113b8888a3f0a68825ed0dea6d3a1aa71b5d0cd6ff16854252c4faea253cf9b"
-"checksum rustc-ap-rustc_data_structures 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bd9eec8c9fbdac20e631f995861c5c854b3f8b2347955614854571457117e51"
-"checksum rustc-ap-rustc_errors 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f55baa0fa4a42a8b354f02015755e7db5619125ad3e625923865f6f1f5688753"
-"checksum rustc-ap-rustc_lexer 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2875181a7886d83b727b1d08291ee430728c2d94c9a7e3f4359df2a14e6c462b"
-"checksum rustc-ap-rustc_macros 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3cadcc9dd4fc3c94c89e103e91f8792f19a1466e0a127d9fb29a2c0ee069389"
-"checksum rustc-ap-rustc_target 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4bdcce1900404a6907785dd31a152ddd723766dfbe29bed6bcca255e7347abdd"
-"checksum rustc-ap-serialize 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "550e295fa077784f7145ba77591aff952fad2279f3ce23a53cf8750fb366c622"
-"checksum rustc-ap-syntax 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "594006d7e68bcff9b5356517667c4e9dd5ec925a2a08660d129b705d0b741ad7"
-"checksum rustc-ap-syntax_pos 542.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ae6751bf44d949b430b151c81772b585686f0ff31e328b68eaa7d406590f848"
+"checksum rustc-ap-arena 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc2e1e68b64268c543bfa6e63e3c0d9ea58074c71396f42f76931f35a9287f9"
+"checksum rustc-ap-graphviz 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c108d647ce0dd46477b048eafff5a6273b5652e02d47424b0cd684147379c811"
+"checksum rustc-ap-rustc_data_structures 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "656771744e0783cb8e4481e3b8b1f975687610aaf18833b898018111a0e0e582"
+"checksum rustc-ap-rustc_errors 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e37064f6624bc799bfaa2968b61ee6880926dea2a8bba69f18aef6c8e69c9604"
+"checksum rustc-ap-rustc_lexer 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5bc0a971823637ea23a857f0ef1467f44b1e05d71968821f83a0abe53e0fe3"
+"checksum rustc-ap-rustc_macros 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b90037e3336fe8835f468db44d0848ae10d9cc8533ae89b55828883f905b7e80"
+"checksum rustc-ap-rustc_target 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cadf9ca07315eab3a7a21f63872f9cc81e250fd6ede0419c24f8926ade73a45d"
+"checksum rustc-ap-serialize 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61673783f2089e01033ffa82d1988f55175402071b31253a358292e1624d4602"
+"checksum rustc-ap-syntax 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28f3dd1346d5b0269c07a4a78855e309a298ab569c9c1302d4d4f57f8eee4e84"
+"checksum rustc-ap-syntax_pos 546.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45e67b526dbda3a0c7dab91c8947d43685e7697f52686a4949da3c179cd7c979"
"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af"
"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
"checksum rustc-rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2e07e19601f21c59aad953c2632172ba70cb27e685771514ea66e4062b3363"
# support. You'll need to write a target specification at least, and most
# likely, teach rustc about the C ABI of the target. Get in touch with the
# Rust team and file an issue if you need assistance in porting!
-#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon"
+#targets = "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
# LLVM experimental targets to build support for. These targets are specified in
# the same format as above, but since these targets are experimental, they are
# not built by default and the experimental Rust compilation targets that depend
-# on them will not work unless the user opts in to building them. By default the
-# `WebAssembly` and `RISCV` targets are enabled when compiling LLVM from scratch.
-#experimental-targets = "WebAssembly;RISCV"
+# on them will not work unless the user opts in to building them.
+#experimental-targets = ""
# Cap the number of parallel linker invocations when compiling LLVM.
# This can be useful when building LLVM with debug info, which significantly
pub llvm_link_shared: bool,
pub llvm_clang_cl: Option<String>,
pub llvm_targets: Option<String>,
- pub llvm_experimental_targets: String,
+ pub llvm_experimental_targets: Option<String>,
pub llvm_link_jobs: Option<u32>,
pub llvm_version_suffix: Option<String>,
pub llvm_use_linker: Option<String>,
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
set(&mut config.llvm_link_shared, llvm.link_shared);
config.llvm_targets = llvm.targets.clone();
- config.llvm_experimental_targets = llvm.experimental_targets.clone()
- .unwrap_or_else(|| "WebAssembly;RISCV".to_string());
+ config.llvm_experimental_targets = llvm.experimental_targets.clone();
config.llvm_link_jobs = llvm.link_jobs;
config.llvm_version_suffix = llvm.version_suffix.clone();
config.llvm_clang_cl = llvm.clang_cl.clone();
} else {
match builder.config.llvm_targets {
Some(ref s) => s,
- None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon",
+ None => "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;\
+ Sparc;SystemZ;WebAssembly;X86",
}
};
let llvm_exp_targets = if self.emscripten {
""
} else {
- &builder.config.llvm_experimental_targets[..]
+ match builder.config.llvm_experimental_targets {
+ Some(ref s) => s,
+ None => "",
+ }
};
let assertions = if builder.config.llvm_assertions {"ON"} else {"OFF"};
fn run(self, builder: &Builder<'_>) {
let src = builder.src.join("src/doc/rustc-guide");
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
- try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src));
+ let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)) {
+ ToolState::TestPass
+ } else {
+ ToolState::TestFail
+ };
+ builder.save_toolstate("rustc-guide", toolstate);
}
}
--- /dev/null
+#
+# Azure Pipelines "auto" branch build for Rust on Linux, macOS, and Windows.
+#
+
+pr: none
+trigger:
+ - auto
+
+variables:
+- group: real-prod-credentials
+
+jobs:
+- job: Linux
+ timeoutInMinutes: 600
+ pool:
+ vmImage: ubuntu-16.04
+ steps:
+ - template: steps/run.yml
+ strategy:
+ matrix:
+ x86_64-gnu-llvm-6.0:
+ IMAGE: x86_64-gnu-llvm-6.0
+ RUST_BACKTRACE: 1
+
+ dist-x86_64-linux:
+ IMAGE: dist-x86_64-linux
+ DEPLOY: 1
+
+ # "alternate" deployments, these are "nightlies" but have LLVM assertions
+ # turned on, they're deployed to a different location primarily for
+ # additional testing.
+ dist-x86_64-linux-alt:
+ IMAGE: dist-x86_64-linux
+ DEPLOY_ALT: 1
+
+ # Linux builders, remaining docker images
+ arm-android:
+ IMAGE: arm-android
+
+ armhf-gnu:
+ IMAGE: armhf-gnu
+
+ dist-various-1:
+ IMAGE: dist-various-1
+ DEPLOY: 1
+
+ dist-various-2:
+ IMAGE: dist-various-2
+ DEPLOY: 1
+
+ dist-aarch64-linux:
+ IMAGE: dist-aarch64-linux
+ DEPLOY: 1
+
+ dist-android:
+ IMAGE: dist-android
+ DEPLOY: 1
+
+ dist-arm-linux:
+ IMAGE: dist-arm-linux
+ DEPLOY: 1
+
+ dist-armhf-linux:
+ IMAGE: dist-armhf-linux
+ DEPLOY: 1
+
+ dist-armv7-linux:
+ IMAGE: dist-armv7-linux
+ DEPLOY: 1
+
+ dist-i586-gnu-i586-i686-musl:
+ IMAGE: dist-i586-gnu-i586-i686-musl
+ DEPLOY: 1
+
+ dist-i686-freebsd:
+ IMAGE: dist-i686-freebsd
+ DEPLOY: 1
+
+ dist-i686-linux:
+ IMAGE: dist-i686-linux
+ DEPLOY: 1
+
+ dist-mips-linux:
+ IMAGE: dist-mips-linux
+ DEPLOY: 1
+
+ dist-mips64-linux:
+ IMAGE: dist-mips64-linux
+ DEPLOY: 1
+
+ dist-mips64el-linux:
+ IMAGE: dist-mips64el-linux
+ DEPLOY: 1
+
+ dist-mipsel-linux:
+ IMAGE: dist-mipsel-linux
+ DEPLOY: 1
+
+ dist-powerpc-linux:
+ IMAGE: dist-powerpc-linux
+ DEPLOY: 1
+
+ dist-powerpc64-linux:
+ IMAGE: dist-powerpc64-linux
+ DEPLOY: 1
+
+ dist-powerpc64le-linux:
+ IMAGE: dist-powerpc64le-linux
+ DEPLOY: 1
+
+ dist-s390x-linux:
+ IMAGE: dist-s390x-linux
+ DEPLOY: 1
+
+ dist-x86_64-freebsd:
+ IMAGE: dist-x86_64-freebsd
+ DEPLOY: 1
+
+ dist-x86_64-musl:
+ IMAGE: dist-x86_64-musl
+ DEPLOY: 1
+
+ dist-x86_64-netbsd:
+ IMAGE: dist-x86_64-netbsd
+ DEPLOY: 1
+
+ asmjs:
+ IMAGE: asmjs
+ i686-gnu:
+ IMAGE: i686-gnu
+ i686-gnu-nopt:
+ IMAGE: i686-gnu-nopt
+ test-various:
+ IMAGE: test-various
+ x86_64-gnu:
+ IMAGE: x86_64-gnu
+ x86_64-gnu-full-bootstrap:
+ IMAGE: x86_64-gnu-full-bootstrap
+ x86_64-gnu-aux:
+ IMAGE: x86_64-gnu-aux
+ x86_64-gnu-tools:
+ IMAGE: x86_64-gnu-tools
+ x86_64-gnu-debug:
+ IMAGE: x86_64-gnu-debug
+ x86_64-gnu-nopt:
+ IMAGE: x86_64-gnu-nopt
+ x86_64-gnu-distcheck:
+ IMAGE: x86_64-gnu-distcheck
+ mingw-check:
+ IMAGE: mingw-check
+
+- job: macOS
+ timeoutInMinutes: 600
+ pool:
+ vmImage: macos-10.13
+ steps:
+ - template: steps/run.yml
+ strategy:
+ matrix:
+ # OSX builders running tests, these run the full test suite.
+ # NO_DEBUG_ASSERTIONS=1 to make them go faster, but also do have some
+ # runners that run `//ignore-debug` tests.
+ #
+ # Note that the compiler is compiled to target 10.8 here because the Xcode
+ # version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
+ x86_64-apple:
+ SCRIPT: ./x.py test
+ RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
+ RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
+ MACOSX_DEPLOYMENT_TARGET: 10.8
+ MACOSX_STD_DEPLOYMENT_TARGET: 10.7
+ NO_LLVM_ASSERTIONS: 1
+ NO_DEBUG_ASSERTIONS: 1
+
+ dist-x86_64-apple:
+ SCRIPT: ./x.py dist
+ RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
+ DEPLOY: 1
+ RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
+ MACOSX_DEPLOYMENT_TARGET: 10.7
+ NO_LLVM_ASSERTIONS: 1
+ NO_DEBUG_ASSERTIONS: 1
+ DIST_REQUIRE_ALL_TOOLS: 1
+
+ dist-x86_64-apple-alt:
+ SCRIPT: ./x.py dist
+ RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
+ DEPLOY_ALT: 1
+ RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
+ MACOSX_DEPLOYMENT_TARGET: 10.7
+ NO_LLVM_ASSERTIONS: 1
+ NO_DEBUG_ASSERTIONS: 1
+
+ i686-apple:
+ SCRIPT: ./x.py test
+ RUST_CONFIGURE_ARGS: --build=i686-apple-darwin --set rust.jemalloc
+ RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
+ MACOSX_DEPLOYMENT_TARGET: 10.8
+ MACOSX_STD_DEPLOYMENT_TARGET: 10.7
+ NO_LLVM_ASSERTIONS: 1
+ NO_DEBUG_ASSERTIONS: 1
+
+ dist-i686-apple:
+ SCRIPT: ./x.py dist
+ RUST_CONFIGURE_ARGS: --build=i686-apple-darwin --enable-full-tools --enable-profiler --set rust.jemalloc
+ DEPLOY: 1
+ RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
+ MACOSX_DEPLOYMENT_TARGET: 10.7
+ NO_LLVM_ASSERTIONS: 1
+ NO_DEBUG_ASSERTIONS: 1
+ DIST_REQUIRE_ALL_TOOLS: 1
+
+
+
+- job: Windows
+ timeoutInMinutes: 600
+ pool:
+ vmImage: 'vs2017-win2016'
+ steps:
+ - template: steps/run.yml
+ strategy:
+ matrix:
+ # 32/64 bit MSVC tests
+ x86_64-msvc-1:
+ MSYS_BITS: 64
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
+ SCRIPT: make ci-subset-1
+ # FIXME(#59637)
+ NO_DEBUG_ASSERTIONS: 1
+ NO_LLVM_ASSERTIONS: 1
+ x86_64-msvc-2:
+ MSYS_BITS: 64
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
+ SCRIPT: make ci-subset-2
+ i686-msvc-1:
+ MSYS_BITS: 32
+ RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
+ SCRIPT: make ci-subset-1
+ i686-msvc-2:
+ MSYS_BITS: 32
+ RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
+ SCRIPT: make ci-subset-2
+ # MSVC aux tests
+ x86_64-msvc-aux:
+ MSYS_BITS: 64
+ RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
+ x86_64-msvc-cargo:
+ MSYS_BITS: 64
+ SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
+ VCVARS_BAT: vcvars64.bat
+ # MSVC tools tests
+ x86_64-msvc-tools:
+ MSYS_BITS: 64
+ SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json --enable-test-miri
+
+ # 32/64-bit MinGW builds.
+ #
+ # We are using MinGW with posix threads since LLVM does not compile with
+ # the win32 threads version due to missing support for C++'s std::thread.
+ #
+ # Instead of relying on the MinGW version installed on appveryor we download
+ # and install one ourselves so we won't be surprised by changes to appveyor's
+ # build image.
+ #
+ # Finally, note that the downloads below are all in the `rust-lang-ci` S3
+ # bucket, but they cleraly didn't originate there! The downloads originally
+ # came from the mingw-w64 SourceForge download site. Unfortunately
+ # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
+ i686-mingw-1:
+ MSYS_BITS: 32
+ RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
+ SCRIPT: make ci-subset-1
+ MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
+ MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
+ MINGW_DIR: mingw32
+ # FIXME(#59637)
+ NO_DEBUG_ASSERTIONS: 1
+ NO_LLVM_ASSERTIONS: 1
+ i686-mingw-2:
+ MSYS_BITS: 32
+ RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
+ SCRIPT: make ci-subset-2
+ MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
+ MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
+ MINGW_DIR: mingw32
+ x86_64-mingw-1:
+ MSYS_BITS: 64
+ SCRIPT: make ci-subset-1
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
+ MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
+ MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
+ MINGW_DIR: mingw64
+ # FIXME(#59637)
+ NO_DEBUG_ASSERTIONS: 1
+ NO_LLVM_ASSERTIONS: 1
+ x86_64-mingw-2:
+ MSYS_BITS: 64
+ SCRIPT: make ci-subset-2
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
+ MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
+ MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
+ MINGW_DIR: mingw64
+
+ # 32/64 bit MSVC and GNU deployment
+ dist-x86_64-msvc:
+ RUST_CONFIGURE_ARGS: >
+ --build=x86_64-pc-windows-msvc
+ --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
+ --enable-full-tools
+ --enable-profiler
+ SCRIPT: python x.py dist
+ DIST_REQUIRE_ALL_TOOLS: 1
+ DEPLOY: 1
+ dist-i686-msvc:
+ RUST_CONFIGURE_ARGS: >
+ --build=i686-pc-windows-msvc
+ --target=i586-pc-windows-msvc
+ --enable-full-tools
+ --enable-profiler
+ SCRIPT: python x.py dist
+ DIST_REQUIRE_ALL_TOOLS: 1
+ DEPLOY: 1
+ dist-i686-mingw:
+ MSYS_BITS: 32
+ RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
+ SCRIPT: python x.py dist
+ MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
+ MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
+ MINGW_DIR: mingw32
+ DIST_REQUIRE_ALL_TOOLS: 1
+ DEPLOY: 1
+ dist-x86_64-mingw:
+ MSYS_BITS: 64
+ SCRIPT: python x.py dist
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
+ MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
+ MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
+ MINGW_DIR: mingw64
+ DIST_REQUIRE_ALL_TOOLS: 1
+ DEPLOY: 1
+
+ # "alternate" deployment, see .travis.yml for more info
+ dist-x86_64-msvc-alt:
+ MSYS_BITS: 64
+ RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
+ SCRIPT: python x.py dist
+ DEPLOY_ALT: 1
--- /dev/null
+#
+# Azure Pipelines job to publish toolstate. Only triggers on pushes to master.
+#
+
+pr: none
+trigger:
+ - master
+
+variables:
+- group: real-prod-credentials
+
+pool:
+ vmImage: ubuntu-16.04
+
+steps:
+- checkout: self
+ fetchDepth: 2
+
+- script: |
+ export MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
+ . src/ci/docker/x86_64-gnu-tools/repo.sh
+ commit_toolstate_change "$MESSAGE_FILE" "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "$MESSAGE_FILE" "$TOOLSTATE_REPO_ACCESS_TOKEN"
+ displayName: Publish toolstate
+ env:
+ TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
--- /dev/null
+#
+# Azure Pipelines pull request build for Rust
+#
+
+trigger: none
+pr:
+- master
+
+variables:
+- group: public-credentials
+
+jobs:
+- job: Linux
+ timeoutInMinutes: 600
+ pool:
+ vmImage: ubuntu-16.04
+ steps:
+ - template: steps/run.yml
+ strategy:
+ matrix:
+ x86_64-gnu-llvm-6.0:
+ IMAGE: x86_64-gnu-llvm-6.0
+ mingw-check:
+ IMAGE: mingw-check
+
+- job: LinuxTools
+ timeoutInMinutes: 600
+ pool:
+ vmImage: ubuntu-16.04
+ steps:
+ - template: steps/run.yml
+ parameters:
+ only_on_updated_submodules: 'yes'
+ variables:
+ IMAGE: x86_64-gnu-tools
--- /dev/null
+steps:
+
+- bash: |
+ set -e
+ curl -f http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz | tar xJf -
+
+ export CC=`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang
+ echo "##vso[task.setvariable variable=CC]$CC"
+
+ export CXX=`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang++
+ echo "##vso[task.setvariable variable=CXX]$CXX"
+
+ # Configure `AR` specifically so rustbuild doesn't try to infer it as
+ # `clang-ar` by accident.
+ echo "##vso[task.setvariable variable=AR]ar"
+ displayName: Install clang (OSX)
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
+
+# If we're compiling for MSVC then we, like most other distribution builders,
+# switch to clang as the compiler. This'll allow us eventually to enable LTO
+# amongst LLVM and rustc. Note that we only do this on MSVC as I don't think
+# clang has an output mode compatible with MinGW that we need. If it does we
+# should switch to clang for MinGW as well!
+#
+# Note that the LLVM installer is an NSIS installer
+#
+# Original downloaded here came from
+# http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe
+# That installer was run through `wine` on Linux and then the resulting
+# installation directory (found in `$HOME/.wine/drive_c/Program Files/LLVM`) was
+# packaged up into a tarball. We've had issues otherwise that the installer will
+# randomly hang, provide not a lot of useful information, pollute global state,
+# etc. In general the tarball is just more confined and easier to deal with when
+# working with various CI environments.
+- bash: |
+ set -e
+ mkdir -p citools
+ cd citools
+ curl -f https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-7.0.0-win64.tar.gz | tar xzf -
+ echo "##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]$RUST_CONFIGURE_ARGS --set llvm.clang-cl=`pwd`/clang-rust/bin/clang-cl.exe"
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
+ displayName: Install clang (Windows)
+
+# Note that we don't install clang on Linux since its compiler story is just so
+# different. Each container has its own toolchain configured appropriately
+# already.
--- /dev/null
+steps:
+
+- bash: |
+ set -e
+ curl -fo /usr/local/bin/sccache https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2018-04-02-sccache-x86_64-apple-darwin
+ chmod +x /usr/local/bin/sccache
+ displayName: Install sccache (OSX)
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
+
+- script: |
+ md sccache
+ powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf sccache\sccache.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2018-04-26-sccache-x86_64-pc-windows-msvc"
+ echo ##vso[task.prependpath]%CD%\sccache
+ displayName: Install sccache (Windows)
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+
+# Note that we don't install sccache on Linux since it's installed elsewhere
+# through all the containers.
+#
+# FIXME: we should probably install sccache outside the containers and then
+# mount it inside the containers so we can centralize all installation here.
--- /dev/null
+steps:
+# We use the WIX toolset to create combined installers for Windows, and these
+# binaries are downloaded from
+# https://github.com/wixtoolset/wix3 originally
+- bash: |
+ set -e
+ curl -O https://rust-lang-ci2.s3-us-west-1.amazonaws.com/rust-ci-mirror/wix311-binaries.zip
+ echo "##vso[task.setvariable variable=WIX]`pwd`/wix"
+ mkdir -p wix/bin
+ cd wix/bin
+ 7z x ../../wix311-binaries.zip
+ displayName: Install wix
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+
+# We use InnoSetup and its `iscc` program to also create combined installers.
+# Honestly at this point WIX above and `iscc` are just holdovers from
+# oh-so-long-ago and are required for creating installers on Windows. I think
+# one is MSI installers and one is EXE, but they're not used so frequently at
+# this point anyway so perhaps it's a wash!
+- script: |
+ powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf is-install.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2017-08-22-is.exe"
+ is-install.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
+ echo ##vso[task.prependpath]C:\Program Files (x86)\Inno Setup 5
+ displayName: Install InnoSetup
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+
+# We've had issues with the default drive in use running out of space during a
+# build, and it looks like the `C:` drive has more space than the default `D:`
+# drive. We should probably confirm this with the azure pipelines team at some
+# point, but this seems to fix our "disk space full" problems.
+- script: |
+ mkdir c:\MORE_SPACE
+ mklink /J build c:\MORE_SPACE
+ displayName: "Ensure build happens on C:/ instead of D:/"
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+
+- bash: git config --replace-all --global core.autocrlf false
+ displayName: "Disable git automatic line ending conversion (on C:/)"
+
+# Download and install MSYS2, needed primarily for the test suite (run-make) but
+# also used by the MinGW toolchain for assembling things.
+#
+# FIXME: we should probe the default azure image and see if we can use the MSYS2
+# toolchain there. (if there's even one there). For now though this gets the job
+# done.
+- script: |
+ set MSYS_PATH=%CD%\citools\msys64
+ choco install msys2 --params="/InstallDir:%MSYS_PATH% /NoPath" -y
+ set PATH=%MSYS_PATH%\usr\bin;%PATH%
+ pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
+ IF "%MINGW_URL%"=="" (
+ IF "%MSYS_BITS%"=="32" pacman -S --noconfirm --needed mingw-w64-i686-toolchain mingw-w64-i686-cmake mingw-w64-i686-gcc mingw-w64-i686-python2
+ IF "%MSYS_BITS%"=="64" pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-python2
+ )
+ where rev
+ rev --help
+ where make
+
+ echo ##vso[task.setvariable variable=MSYS_PATH]%MSYS_PATH%
+ echo ##vso[task.prependpath]%MSYS_PATH%\usr\bin
+ displayName: Install msys2
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+
+# If we need to download a custom MinGW, do so here and set the path
+# appropriately.
+#
+# Here we also do a pretty heinous thing which is to mangle the MinGW
+# installation we just downloaded. Currently, as of this writing, we're using
+# MinGW-w64 builds of gcc, and that's currently at 6.3.0. We use 6.3.0 as it
+# appears to be the first version which contains a fix for #40546, builds
+# randomly failing during LLVM due to ar.exe/ranlib.exe failures.
+#
+# Unfortunately, though, 6.3.0 *also* is the first version of MinGW-w64 builds
+# to contain a regression in gdb (#40184). As a result if we were to use the
+# gdb provided (7.11.1) then we would fail all debuginfo tests.
+#
+# In order to fix spurious failures (pretty high priority) we use 6.3.0. To
+# avoid disabling gdb tests we download an *old* version of gdb, specifically
+# that found inside the 6.2.0 distribution. We then overwrite the 6.3.0 gdb
+# with the 6.2.0 gdb to get tests passing.
+#
+# Note that we don't literally overwrite the gdb.exe binary because it appears
+# to just use gdborig.exe, so that's the binary we deal with instead.
+- script: |
+ powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %MINGW_ARCHIVE% %MINGW_URL%/%MINGW_ARCHIVE%"
+ 7z x -y %MINGW_ARCHIVE% > nul
+ powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_URL%/2017-04-20-%MSYS_BITS%bit-gdborig.exe"
+ mv 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_DIR%\bin\gdborig.exe
+ echo ##vso[task.prependpath]%CD%\%MINGW_DIR%\bin
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['MINGW_URL'],''))
+ displayName: Download custom MinGW
+
+# Otherwise pull in the MinGW installed on appveyor
+- script: |
+ echo ##vso[task.prependpath]%MSYS_PATH%\mingw%MSYS_BITS%\bin
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
+ displayName: Add MinGW to path
+
+# Make sure we use the native python interpreter instead of some msys equivalent
+# one way or another. The msys interpreters seem to have weird path conversions
+# baked in which break LLVM's build system one way or another, so let's use the
+# native version which keeps everything as native as possible.
+- script: |
+ copy C:\Python27amd64\python.exe C:\Python27amd64\python2.7.exe
+ echo ##vso[task.prependpath]C:\Python27amd64
+ displayName: Prefer the "native" Python as LLVM has trouble building with MSYS sometimes
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+
+# Note that this is originally from the github releases patch of Ninja
+- script: |
+ md ninja
+ powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-03-15-ninja-win.zip https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2017-03-15-ninja-win.zip"
+ 7z x -oninja 2017-03-15-ninja-win.zip
+ del 2017-03-15-ninja-win.zip
+ set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja
+ echo ##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]%RUST_CONFIGURE_ARGS%
+ echo ##vso[task.prependpath]%CD%\ninja
+ displayName: Download and install ninja
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
--- /dev/null
+# FIXME(linux): need to configure core dumps, enable them, and then dump
+# backtraces on failure from all core dumps:
+#
+# - bash: sudo apt install gdb
+# - bash: sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern'
+#
+# Check travis config for `gdb --batch` command to print all crash logs
+
+parameters:
+ # When this parameter is set to anything other than an empty string the tests
+ # will only be executed when the commit updates submodules
+ only_on_updated_submodules: ''
+
+steps:
+
+# Disable automatic line ending conversion, which is enabled by default on
+# Azure's Windows image. Having the conversion enabled caused regressions both
+# in our test suite (it broke miri tests) and in the ecosystem, since we
+# started shipping install scripts with CRLF endings instead of the old LF.
+#
+# Note that we do this a couple times during the build as the PATH and current
+# user/directory change, e.g. when mingw is enabled.
+- bash: git config --global core.autocrlf false
+ displayName: "Disable git automatic line ending conversion"
+
+- checkout: self
+ fetchDepth: 2
+
+# Set the SKIP_JOB environment variable if this job is supposed to only run
+# when submodules are updated and they were not. The following time consuming
+# tasks will be skipped when the environment variable is present.
+- ${{ if parameters.only_on_updated_submodules }}:
+ - bash: |
+ set -e
+ # Submodules pseudo-files inside git have the 160000 permissions, so when
+ # those files are present in the diff a submodule was updated.
+ if git diff HEAD^ | grep "^index .* 160000" >/dev/null 2>&1; then
+ echo "Executing the job since submodules are updated"
+ else
+ echo "Not executing this job since no submodules were updated"
+ echo "##vso[task.setvariable variable=SKIP_JOB;]1"
+ fi
+ displayName: Decide whether to run this job
+
+# Spawn a background process to collect CPU usage statistics which we'll upload
+# at the end of the build. See the comments in the script here for more
+# information.
+- bash: python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
+ displayName: "Collect CPU-usage statistics in the background"
+
+- bash: printenv | sort
+ displayName: Show environment variables
+
+- bash: |
+ set -e
+ df -h
+ du . | sort -nr | head -n100
+ displayName: Show disk usage
+ # FIXME: this hasn't been tested, but maybe it works on Windows? Should test!
+ condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
+
+- template: install-sccache.yml
+- template: install-clang.yml
+
+# Switch to XCode 9.3 on OSX since it seems to be the last version that supports
+# i686-apple-darwin. We'll eventually want to upgrade this and it will probably
+# force us to drop i686-apple-darwin, but let's keep the wheels turning for now.
+- bash: |
+ set -e
+ sudo xcode-select --switch /Applications/Xcode_9.3.app
+ displayName: Switch to Xcode 9.3 (OSX)
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
+
+- template: install-windows-build-deps.yml
+
+# Looks like docker containers have IPv6 disabled by default, so let's turn it
+# on since libstd tests require it
+- bash: |
+ set -e
+ sudo mkdir -p /etc/docker
+ echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
+ sudo service docker restart
+ displayName: Enable IPv6
+ condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
+
+# Disable automatic line ending conversion (again). On Windows, when we're
+# installing dependencies, something switches the git configuration directory or
+# re-enables autocrlf. We've not tracked down the exact cause -- and there may
+# be multiple -- but this should ensure submodules are checked out with the
+# appropriate line endings.
+- bash: git config --replace-all --global core.autocrlf false
+ displayName: "Disable git automatic line ending conversion"
+
+# Check out all our submodules, but more quickly than using git by using one of
+# our custom scripts
+- bash: |
+ set -e
+ mkdir -p $HOME/rustsrc
+ $BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
+ condition: and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Windows_NT'))
+ displayName: Check out submodules (Unix)
+- script: |
+ if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
+ sh src/ci/init_repo.sh . /c/cache/rustsrc
+ condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Windows_NT'))
+ displayName: Check out submodules (Windows)
+
+# See also the disable for autocrlf above, this just checks that it worked
+#
+# We check both in rust-lang/rust and in a submodule to make sure both are
+# accurate. Submodules are checked out significantly later than the main
+# repository in this script, so settings can (and do!) change between then.
+#
+# Linux (and maybe macOS) builders don't currently have dos2unix so just only
+# run this step on Windows.
+- bash: |
+ set -x
+ # print out the git configuration so we can better investigate failures in
+ # the following
+ git config --list --show-origin
+ dos2unix -ih Cargo.lock src/tools/rust-installer/install-template.sh
+ endings=$(dos2unix -ic Cargo.lock src/tools/rust-installer/install-template.sh)
+ # if endings has non-zero length, error out
+ if [ -n "$endings" ]; then exit 1 ; fi
+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
+ displayName: Verify line endings are LF
+
+# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
+# images, etc.
+- bash: src/ci/install-awscli.sh
+ env:
+ AGENT_OS: $(Agent.OS)
+ condition: and(succeeded(), not(variables.SKIP_JOB))
+ displayName: Install awscli
+
+# Configure our CI_JOB_NAME variable which log analyzers can use for the main
+# step to see what's going on.
+- bash: |
+ builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
+ echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
+ displayName: Configure Job Name
+
+# As a quick smoke check on the otherwise very fast mingw-check linux builder
+# check our own internal scripts.
+- bash: |
+ set -e
+ git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
+ cd rust-toolstate
+ python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
+ cd ..
+ rm -rf rust-toolstate
+ condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
+ displayName: Verify the publish_toolstate script works
+
+- bash: |
+ set -e
+ # Remove any preexisting rustup installation since it can interfere
+ # with the cargotest step and its auto-detection of things like Clippy in
+ # the environment
+ rustup self uninstall -y || true
+ if [ "$IMAGE" = "" ]; then
+ src/ci/run.sh
+ else
+ src/ci/docker/run.sh $IMAGE
+ fi
+ #timeoutInMinutes: 180
+ timeoutInMinutes: 600
+ env:
+ CI: true
+ SRC: .
+ AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
+ TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
+ condition: and(succeeded(), not(variables.SKIP_JOB))
+ displayName: Run build
+
+# If we're a deploy builder, use the `aws` command to publish everything to our
+# bucket.
+- bash: |
+ set -e
+ source src/ci/shared.sh
+ if [ "$AGENT_OS" = "Linux" ]; then
+ rm -rf obj/build/dist/doc
+ upload_dir=obj/build/dist
+ else
+ rm -rf build/dist/doc
+ upload_dir=build/dist
+ fi
+ ls -la $upload_dir
+ deploy_dir=rustc-builds
+ if [ "$DEPLOY_ALT" == "1" ]; then
+ deploy_dir=rustc-builds-alt
+ fi
+ retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
+ env:
+ AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
+ condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
+ displayName: Upload artifacts
+
+# Upload CPU usage statistics that we've been gathering this whole time. Always
+# execute this step in case we want to inspect failed builds, but don't let
+# errors here ever fail the build since this is just informational.
+- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
+ env:
+ AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
+ condition: variables['AWS_SECRET_ACCESS_KEY']
+ continueOnError: true
+ displayName: Upload CPU usage statistics
--- /dev/null
+pr: none
+trigger:
+- try
+
+variables:
+- group: real-prod-credentials
+
+jobs:
+- job: Linux
+ timeoutInMinutes: 600
+ pool:
+ vmImage: ubuntu-16.04
+ steps:
+ - template: steps/run.yml
+ strategy:
+ matrix:
+ dist-x86_64-linux:
+ IMAGE: dist-x86_64-linux
+ DEPLOY: 1
+
+ dist-x86_64-linux-alt:
+ IMAGE: dist-x86_64-linux
+ DEPLOY_ALT: 1
+
+# The macOS and Windows builds here are currently disabled due to them not being
+# overly necessary on `try` builds. We also don't actually have anything that
+# consumes the artifacts currently. Perhaps one day we can reenable, but for now
+# it helps free up capacity on Azure.
+# - job: macOS
+# timeoutInMinutes: 600
+# pool:
+# vmImage: macos-10.13
+# steps:
+# - template: steps/run.yml
+# strategy:
+# matrix:
+# dist-x86_64-apple:
+# SCRIPT: ./x.py dist
+# RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
+# DEPLOY: 1
+# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
+# MACOSX_DEPLOYMENT_TARGET: 10.7
+# NO_LLVM_ASSERTIONS: 1
+# NO_DEBUG_ASSERTIONS: 1
+# DIST_REQUIRE_ALL_TOOLS: 1
+#
+# dist-x86_64-apple-alt:
+# SCRIPT: ./x.py dist
+# RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
+# DEPLOY_ALT: 1
+# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
+# MACOSX_DEPLOYMENT_TARGET: 10.7
+# NO_LLVM_ASSERTIONS: 1
+# NO_DEBUG_ASSERTIONS: 1
+#
+# - job: Windows
+# timeoutInMinutes: 600
+# pool:
+# vmImage: 'vs2017-win2016'
+# steps:
+# - template: steps/run.yml
+# strategy:
+# matrix:
+# dist-x86_64-msvc:
+# RUST_CONFIGURE_ARGS: >
+# --build=x86_64-pc-windows-msvc
+# --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
+# --enable-full-tools
+# --enable-profiler
+# SCRIPT: python x.py dist
+# DIST_REQUIRE_ALL_TOOLS: 1
+# DEPLOY: 1
+#
+# dist-x86_64-msvc-alt:
+# MSYS_BITS: 64
+# RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
+# SCRIPT: python x.py dist
+# DEPLOY_ALT: 1
#
# The function relies on a GitHub bot user, which should have a Personal access
# token defined in the environment variable $TOOLSTATE_REPO_ACCESS_TOKEN. If for
-# some reason you need to change the token, please update `.azure-pipelines/*`.
+# some reason you need to change the token, please update the Azure Pipelines
+# variable group.
#
# 1. Generate a new Personal access token:
#
use syntax::parse::token::{self, 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_pos::Span;
use rustc_plugin::Registry;
To print syntax fragments for debugging, you can use `span_note` together with
`syntax::print::pprust::*_to_string`.
-The example above produced an integer literal using `AstBuilder::expr_usize`.
-As an alternative to the `AstBuilder` trait, `libsyntax` provides a set of
-quasiquote macros. They are undocumented and very rough around the edges.
-However, the implementation may be a good starting point for an improved
-quasiquote as an ordinary plugin library.
-
-
# Lint plugins
Plugins can extend [Rust's lint
let uc_nested = attr::mk_nested_word_item(uc_ident);
attr::mk_list_item(e.span, allow_ident, vec![uc_nested])
};
- attr::mk_spanned_attr_outer(e.span, attr::mk_attr_id(), allow)
+ attr::mk_attr_outer(allow)
};
let attrs = vec![attr];
fn visit_pat(&mut self, pat: &'tcx hir::Pat) {
match pat.node {
- PatKind::Struct(hir::QPath::Resolved(_, ref path), ref fields, _) => {
- self.handle_field_pattern_match(pat, path.res, fields);
+ PatKind::Struct(ref path, ref fields, _) => {
+ let res = self.tables.qpath_res(path, pat.hir_id);
+ self.handle_field_pattern_match(pat, res, fields);
}
PatKind::Path(ref qpath @ hir::QPath::TypeRelative(..)) => {
let res = self.tables.qpath_res(qpath, pat.hir_id);
}
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
-pub enum UndefinedBehaviourInfo {
+pub enum UndefinedBehaviorInfo {
/// Handle cases which for which we do not have a fixed variant.
Ub(String),
/// Unreachable code was executed.
Unreachable,
}
-impl fmt::Debug for UndefinedBehaviourInfo {
+impl fmt::Debug for UndefinedBehaviorInfo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- use UndefinedBehaviourInfo::*;
+ use UndefinedBehaviorInfo::*;
match self {
Ub(ref msg) =>
write!(f, "{}", msg),
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
pub enum UnsupportedOpInfo<'tcx> {
/// Handle cases which for which we do not have a fixed variant.
- Unimplemented(String),
+ Unsupported(String),
// -- Everything below is not classified yet --
FunctionAbiMismatch(Abi, Abi),
ReadUndefBytes(Size),
DeadLocal,
InvalidBoolOp(mir::BinOp),
- InlineAsm,
UnimplementedTraitSelection,
CalledClosureAsFunction,
NoMirFor(String),
- /// This variant is used by machines to signal their own errors that do not
- /// match an existing variant.
- MachineError(String),
DerefFunctionPointer,
ExecuteMemory,
- Intrinsic(String),
InvalidChar(u128),
OutOfTls,
TlsOutOfBounds,
- AbiViolation(String),
AlignmentCheckFailed {
required: Align,
has: Align,
initializer"),
AssumptionNotHeld =>
write!(f, "`assume` argument was false"),
- InlineAsm =>
- write!(f, "miri does not support inline assembly"),
ReallocateNonBasePtr =>
write!(f, "tried to reallocate with a pointer not to the beginning of an \
existing object"),
HeapAllocNonPowerOfTwoAlignment(_) =>
write!(f, "tried to re-, de-, or allocate heap memory with alignment that is \
not a power of two"),
- MachineError(ref msg) |
- Unimplemented(ref msg) |
- AbiViolation(ref msg) |
- Intrinsic(ref msg) =>
+ Unsupported(ref msg) =>
write!(f, "{}", msg),
}
}
/// The program panicked.
Panic(PanicInfo<u64>),
/// The program caused undefined behavior.
- UndefinedBehaviour(UndefinedBehaviourInfo),
+ UndefinedBehavior(UndefinedBehaviorInfo),
/// The program did something the interpreter does not support (some of these *might* be UB
/// but the interpreter is not sure).
Unsupported(UnsupportedOpInfo<'tcx>),
write!(f, "{:?}", msg),
InvalidProgram(ref msg) =>
write!(f, "{:?}", msg),
- UndefinedBehaviour(ref msg) =>
+ UndefinedBehavior(ref msg) =>
write!(f, "{:?}", msg),
ResourceExhaustion(ref msg) =>
write!(f, "{:?}", msg),
#[macro_export]
macro_rules! err_ub {
($($tt:tt)*) => {
- $crate::mir::interpret::InterpError::UndefinedBehaviour(
- $crate::mir::interpret::UndefinedBehaviourInfo::$($tt)*
+ $crate::mir::interpret::InterpError::UndefinedBehavior(
+ $crate::mir::interpret::UndefinedBehaviorInfo::$($tt)*
)
};
}
($($tt:tt)*) => { return Err(err_unsup!($($tt)*).into()) };
}
+#[macro_export]
+macro_rules! throw_unsup_format {
+ ($($tt:tt)*) => { throw_unsup!(Unsupported(format!($($tt)*))) };
+}
+
#[macro_export]
macro_rules! throw_inval {
($($tt:tt)*) => { return Err(err_inval!($($tt)*).into()) };
($($tt:tt)*) => { return Err(err_ub!($($tt)*).into()) };
}
+#[macro_export]
+macro_rules! throw_ub_format {
+ ($($tt:tt)*) => { throw_ub!(Ub(format!($($tt)*))) };
+}
+
#[macro_export]
macro_rules! throw_panic {
($($tt:tt)*) => { return Err(err_panic!($($tt)*).into()) };
pub use self::error::{
InterpErrorInfo, InterpResult, InterpError, AssertMessage, ConstEvalErr, struct_error,
FrameInfo, ConstEvalRawResult, ConstEvalResult, ErrorHandled, PanicInfo, UnsupportedOpInfo,
- InvalidProgramInfo, ResourceExhaustionInfo, UndefinedBehaviourInfo,
+ InvalidProgramInfo, ResourceExhaustionInfo, UndefinedBehaviorInfo,
};
pub use self::value::{Scalar, ScalarMaybeUndef, RawConst, ConstValue};
}
TypeChecking {
- query check_match(key: DefId) -> () {
+ query check_match(key: DefId) -> SignalledError {
cache_on_disk_if { key.is_local() }
}
use crate::hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
use crate::infer::canonical::{self, Canonical};
use crate::lint;
-use crate::middle::borrowck::BorrowCheckResult;
+use crate::middle::borrowck::{BorrowCheckResult, SignalledError};
use crate::middle::cstore::{ExternCrate, LinkagePreference, NativeLibrary, ForeignModule};
use crate::middle::cstore::{NativeLibraryKind, DepKind, CrateSource};
use crate::middle::privacy::AccessLevels;
}
}
+ /// Tests if this is any kind of primitive pointer type (reference, raw pointer, fn pointer).
+ #[inline]
+ pub fn is_any_ptr(&self) -> bool {
+ self.is_region_ptr() || self.is_unsafe_ptr() || self.is_fn_ptr()
+ }
+
/// Returns `true` if this type is an `Arc<T>`.
#[inline]
pub fn is_arc(&self) -> bool {
debug!("borrowck(body_owner_def_id={:?})", owner_def_id);
+ let signalled_error = tcx.check_match(owner_def_id);
+ if let SignalledError::SawSomeError = signalled_error {
+ return tcx.arena.alloc(BorrowCheckResult {
+ signalled_any_error: SignalledError::SawSomeError,
+ })
+ }
+
let owner_id = tcx.hir().as_local_hir_id(owner_def_id).unwrap();
match tcx.hir().get(owner_id) {
}
fn get_attributes(&self, item: &Entry<'tcx>, sess: &Session) -> Vec<ast::Attribute> {
- item.attributes
- .decode((self, sess))
- .map(|mut attr| {
- // Need new unique IDs: old thread-local IDs won't map to new threads.
- attr.id = attr::mk_attr_id();
- attr
- })
- .collect()
+ item.attributes.decode((self, sess)).collect()
}
// Translate a DefId from the current compilation environment to a DefId
use syntax::source_map::{Span, DUMMY_SP};
use crate::interpret::{self,
- PlaceTy, MPlaceTy, OpTy, ImmTy, Immediate, Scalar,
+ PlaceTy, MPlaceTy, OpTy, ImmTy, Immediate, Scalar, Pointer,
RawConst, ConstValue,
InterpResult, InterpErrorInfo, GlobalId, InterpCx, StackPopCleanup,
- Allocation, AllocId, MemoryKind,
+ Allocation, AllocId, MemoryKind, Memory,
snapshot, RefTracking, intern_const_alloc_recursive,
};
Ok(ret)
}
-impl<'tcx> Into<InterpErrorInfo<'tcx>> for ConstEvalError {
- fn into(self) -> InterpErrorInfo<'tcx> {
- err_unsup!(MachineError(self.to_string())).into()
- }
-}
-
#[derive(Clone, Debug)]
enum ConstEvalError {
NeedsRfc(String),
}
+impl<'tcx> Into<InterpErrorInfo<'tcx>> for ConstEvalError {
+ fn into(self) -> InterpErrorInfo<'tcx> {
+ err_unsup!(Unsupported(self.to_string())).into()
+ }
+}
+
impl fmt::Display for ConstEvalError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::ConstEvalError::*;
debug!("eval_fn_call: {:?}", 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-
+ // Execution might have wandered off into other crates, so we cannot do 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) {
ecx.goto_block(ret)?; // fully evaluated and done
Ok(None)
} else {
- throw_unsup!(MachineError(format!("calling non-const function `{}`", instance)))
+ throw_unsup_format!("calling non-const function `{}`", instance)
};
}
}
)
}
- fn ptr_op(
+ fn ptr_to_int(
+ _mem: &Memory<'mir, 'tcx, Self>,
+ _ptr: Pointer,
+ ) -> InterpResult<'tcx, u64> {
+ Err(
+ ConstEvalError::NeedsRfc("pointer-to-integer cast".to_string()).into(),
+ )
+ }
+
+ fn binary_ptr_op(
_ecx: &InterpCx<'mir, 'tcx, Self>,
_bin_op: mir::BinOp,
_left: ImmTy<'tcx>,
could cause the match to be non-exhaustive:
```compile_fail,E0510
-#![feature(nll, bind_by_move_pattern_guards)]
+#![feature(bind_by_move_pattern_guards)]
let mut x = Some(0);
match x {
None => (),
use super::{Pattern, PatternContext, PatternError, PatternKind};
+use rustc::middle::borrowck::SignalledError;
use rustc::middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor};
use rustc::middle::expr_use_visitor::{LoanCause, MutateMode};
use rustc::middle::expr_use_visitor as euv;
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
-pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
+crate fn check_match(tcx: TyCtxt<'_>, def_id: DefId) -> SignalledError {
let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
tcx.hir().body_owned_by(id)
} else {
- return;
+ return SignalledError::NoErrorsSeen;
};
- MatchVisitor {
+ let mut visitor = MatchVisitor {
tcx,
body_owner: def_id,
tables: tcx.body_tables(body_id),
region_scope_tree: &tcx.region_scope_tree(def_id),
param_env: tcx.param_env(def_id),
identity_substs: InternalSubsts::identity_for_item(tcx, def_id),
- }.visit_body(tcx.hir().body(body_id));
+ signalled_error: SignalledError::NoErrorsSeen,
+ };
+ visitor.visit_body(tcx.hir().body(body_id));
+ visitor.signalled_error
}
fn create_e0004(sess: &Session, sp: Span, error_message: String) -> DiagnosticBuilder<'_> {
param_env: ty::ParamEnv<'tcx>,
identity_substs: SubstsRef<'tcx>,
region_scope_tree: &'a region::ScopeTree,
+ signalled_error: SignalledError,
}
impl<'a, 'tcx> Visitor<'tcx> for MatchVisitor<'a, 'tcx> {
fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
intravisit::walk_expr(self, ex);
- match ex.node {
- hir::ExprKind::Match(ref scrut, ref arms, source) => {
- self.check_match(scrut, arms, source);
- }
- _ => {}
+ if let hir::ExprKind::Match(ref scrut, ref arms, source) = ex.node {
+ self.check_match(scrut, arms, source);
}
}
}
impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
- fn check_patterns(&self, has_guard: bool, pats: &[P<Pat>]) {
+ fn check_patterns(&mut self, has_guard: bool, pats: &[P<Pat>]) {
check_legality_of_move_bindings(self, has_guard, pats);
for pat in pats {
check_legality_of_bindings_in_at_patterns(self, pat);
}
fn check_match(
- &self,
+ &mut self,
scrut: &hir::Expr,
arms: &'tcx [hir::Arm],
- source: hir::MatchSource)
- {
+ source: hir::MatchSource
+ ) {
for arm in arms {
// First, check legality of move bindings.
self.check_patterns(arm.guard.is_some(), &arm.pats);
// Second, if there is a guard on each arm, make sure it isn't
// assigning or borrowing anything mutably.
if let Some(ref guard) = arm.guard {
+ self.signalled_error = SignalledError::SawSomeError;
if !self.tcx.features().bind_by_move_pattern_guards {
check_for_mutation_in_guard(self, &guard);
}
// Legality of move bindings checking
fn check_legality_of_move_bindings(
- cx: &MatchVisitor<'_, '_>,
+ cx: &mut MatchVisitor<'_, '_>,
has_guard: bool,
pats: &[P<Pat>],
) {
})
}
let span_vec = &mut Vec::new();
- let check_move = |p: &Pat, sub: Option<&Pat>, span_vec: &mut Vec<Span>| {
+ let check_move = |
+ cx: &mut MatchVisitor<'_, '_>,
+ p: &Pat,
+ sub: Option<&Pat>,
+ span_vec: &mut Vec<Span>,
+ | {
// check legality of moving out of the enum
// x @ Foo(..) is legal, but x @ Foo(y) isn't.
"cannot bind by-move with sub-bindings")
.span_label(p.span, "binds an already bound by-move value by moving it")
.emit();
- } else if has_guard && !cx.tcx.features().bind_by_move_pattern_guards {
- let mut err = struct_span_err!(cx.tcx.sess, p.span, E0008,
- "cannot bind by-move into a pattern guard");
- err.span_label(p.span, "moves value into pattern guard");
- if cx.tcx.sess.opts.unstable_features.is_nightly_build() {
- err.help("add `#![feature(bind_by_move_pattern_guards)]` to the \
- crate attributes to enable");
+ } else if has_guard {
+ if !cx.tcx.features().bind_by_move_pattern_guards {
+ let mut err = struct_span_err!(cx.tcx.sess, p.span, E0008,
+ "cannot bind by-move into a pattern guard");
+ err.span_label(p.span, "moves value into pattern guard");
+ if cx.tcx.sess.opts.unstable_features.is_nightly_build() {
+ err.help("add `#![feature(bind_by_move_pattern_guards)]` to the \
+ crate attributes to enable");
+ }
+ err.emit();
}
- err.emit();
} else if let Some(_by_ref_span) = by_ref_span {
span_vec.push(p.span);
}
ty::BindByValue(..) => {
let pat_ty = cx.tables.node_type(p.hir_id);
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);
+ check_move(cx, p, sub.as_ref().map(|p| &**p), span_vec);
}
}
_ => {}
use rustc_apfloat::ieee::{Single, Double};
use rustc_apfloat::{Float, FloatConvert};
use rustc::mir::interpret::{
- Scalar, InterpResult, Pointer, PointerArithmetic,
+ Scalar, InterpResult, PointerArithmetic,
};
use rustc::mir::CastKind;
-use super::{InterpCx, Machine, PlaceTy, OpTy, Immediate, FnVal};
+use super::{InterpCx, Machine, PlaceTy, OpTy, ImmTy, Immediate, FnVal};
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
- fn type_is_fat_ptr(&self, ty: Ty<'tcx>) -> bool {
- match ty.sty {
- ty::RawPtr(ty::TypeAndMut { ty, .. }) |
- ty::Ref(_, ty, _) => !self.type_is_sized(ty),
- ty::Adt(def, _) if def.is_box() => !self.type_is_sized(ty.boxed_ty()),
- _ => false,
- }
- }
-
pub fn cast(
&mut self,
src: OpTy<'tcx, M::PointerTag>,
Misc | Pointer(PointerCast::MutToConstPointer) => {
let src = self.read_immediate(src)?;
-
- 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)?;
- }
- // slices and trait objects to thin pointers (dropping the metadata)
- (Immediate::ScalarPair(data, _), false) => {
- self.write_scalar(data, dest)?;
- }
- }
- } else {
- match src.layout.variants {
- layout::Variants::Single { index } => {
- if let Some(discr) =
- src.layout.ty.discriminant_for_variant(*self.tcx, index)
- {
- // Cast from a univariant enum
- assert!(src.layout.is_zst());
- return self.write_scalar(
- Scalar::from_uint(discr.val, dest.layout.size),
- dest);
- }
- }
- layout::Variants::Multiple { .. } => {},
- }
-
- let dest_val = self.cast_scalar(src.to_scalar()?, src.layout, dest.layout)?;
- self.write_scalar(dest_val, dest)?;
- }
+ let res = self.cast_immediate(src, dest.layout)?;
+ self.write_immediate(res, dest)?;
}
Pointer(PointerCast::ReifyFnPointer) => {
Ok(())
}
- fn cast_scalar(
+ fn cast_immediate(
&self,
- val: Scalar<M::PointerTag>,
- src_layout: TyLayout<'tcx>,
+ src: ImmTy<'tcx, M::PointerTag>,
dest_layout: TyLayout<'tcx>,
- ) -> InterpResult<'tcx, Scalar<M::PointerTag>> {
+ ) -> InterpResult<'tcx, Immediate<M::PointerTag>> {
use rustc::ty::TyKind::*;
- trace!("Casting {:?}: {:?} to {:?}", val, src_layout.ty, dest_layout.ty);
+ trace!("Casting {:?}: {:?} to {:?}", *src, src.layout.ty, dest_layout.ty);
- match src_layout.ty.sty {
+ match src.layout.ty.sty {
// Floating point
- Float(FloatTy::F32) => self.cast_from_float(val.to_f32()?, dest_layout.ty),
- Float(FloatTy::F64) => self.cast_from_float(val.to_f64()?, dest_layout.ty),
- // Integer(-like), including fn ptr casts and casts from enums that
- // are represented as integers (this excludes univariant enums, which
- // are handled in `cast` directly).
- _ => {
+ Float(FloatTy::F32) =>
+ return Ok(self.cast_from_float(src.to_scalar()?.to_f32()?, dest_layout.ty)?.into()),
+ Float(FloatTy::F64) =>
+ return Ok(self.cast_from_float(src.to_scalar()?.to_f64()?, dest_layout.ty)?.into()),
+ // The rest is integer/pointer-"like", including fn ptr casts and casts from enums that
+ // are represented as integers.
+ _ =>
assert!(
- src_layout.ty.is_bool() || src_layout.ty.is_char() ||
- src_layout.ty.is_enum() || src_layout.ty.is_integral() ||
- src_layout.ty.is_unsafe_ptr() || src_layout.ty.is_fn_ptr() ||
- src_layout.ty.is_region_ptr(),
- "Unexpected cast from type {:?}", src_layout.ty
- );
- match val.to_bits_or_ptr(src_layout.size, self) {
- Err(ptr) => self.cast_from_ptr(ptr, src_layout, dest_layout),
- Ok(data) => self.cast_from_int(data, src_layout, dest_layout),
+ src.layout.ty.is_bool() || src.layout.ty.is_char() ||
+ src.layout.ty.is_enum() || src.layout.ty.is_integral() ||
+ src.layout.ty.is_any_ptr(),
+ "Unexpected cast from type {:?}", src.layout.ty
+ )
+ }
+
+ // Handle cast from a univariant (ZST) enum.
+ match src.layout.variants {
+ layout::Variants::Single { index } => {
+ if let Some(discr) =
+ src.layout.ty.discriminant_for_variant(*self.tcx, index)
+ {
+ assert!(src.layout.is_zst());
+ return Ok(Scalar::from_uint(discr.val, dest_layout.size).into());
}
}
+ layout::Variants::Multiple { .. } => {},
+ }
+
+ // Handle casting the metadata away from a fat pointer.
+ if src.layout.ty.is_unsafe_ptr() && dest_layout.ty.is_unsafe_ptr() &&
+ dest_layout.size != src.layout.size
+ {
+ assert_eq!(src.layout.size, 2*self.memory.pointer_size());
+ assert_eq!(dest_layout.size, self.memory.pointer_size());
+ assert!(dest_layout.ty.is_unsafe_ptr());
+ match *src {
+ Immediate::ScalarPair(data, _) =>
+ return Ok(data.into()),
+ Immediate::Scalar(..) =>
+ bug!(
+ "{:?} input to a fat-to-thin cast ({:?} -> {:?})",
+ *src, src.layout.ty, dest_layout.ty
+ ),
+ };
+ }
+
+ // Handle casting any ptr to raw ptr (might be a fat ptr).
+ if src.layout.ty.is_any_ptr() && dest_layout.ty.is_unsafe_ptr()
+ {
+ // The only possible size-unequal case was handled above.
+ assert_eq!(src.layout.size, dest_layout.size);
+ return Ok(*src);
}
+
+ // For all remaining casts, we either
+ // (a) cast a raw ptr to usize, or
+ // (b) cast from an integer-like (including bool, char, enums).
+ // In both cases we want the bits.
+ let bits = self.force_bits(src.to_scalar()?, src.layout.size)?;
+ Ok(self.cast_from_int(bits, src.layout, dest_layout)?.into())
}
fn cast_from_int(
},
// Casts to bool are not permitted by rustc, no need to handle them here.
- _ => throw_unsup!(Unimplemented(format!("int to {:?} cast", dest_layout.ty))),
+ _ => bug!("invalid int to {:?} cast", dest_layout.ty),
}
}
}
}
- fn cast_from_ptr(
- &self,
- ptr: Pointer<M::PointerTag>,
- src_layout: TyLayout<'tcx>,
- dest_layout: TyLayout<'tcx>,
- ) -> InterpResult<'tcx, Scalar<M::PointerTag>> {
- use rustc::ty::TyKind::*;
-
- match dest_layout.ty.sty {
- // Casting to a reference or fn pointer is not permitted by rustc,
- // no need to support it here.
- RawPtr(_) => Ok(ptr.into()),
- Int(_) | Uint(_) => {
- let size = self.memory.pointer_size();
-
- match self.force_bits(Scalar::Ptr(ptr), size) {
- Ok(bits) => self.cast_from_int(bits, src_layout, dest_layout),
- Err(_) if dest_layout.size == size => Ok(ptr.into()),
- Err(e) => Err(e),
- }
- }
- _ => bug!("invalid MIR: ptr to {:?} cast", dest_layout.ty)
- }
- }
-
fn unsize_into_ptr(
&mut self,
src: OpTy<'tcx, M::PointerTag>,
let bits = self.read_scalar(args[0])?.to_bits(layout_of.size)?;
let kind = match layout_of.abi {
ty::layout::Abi::Scalar(ref scalar) => scalar.value,
- _ => Err(err_unsup!(TypeNotPrimitive(ty)))?,
+ _ => throw_unsup!(TypeNotPrimitive(ty)),
};
let out_val = if intrinsic_name.ends_with("_nonzero") {
if bits == 0 {
- throw_unsup!(Intrinsic(format!("{} called on 0", intrinsic_name)))
+ throw_ub_format!("`{}` called on 0", intrinsic_name);
}
numeric_intrinsic(intrinsic_name.trim_end_matches("_nonzero"), bits, kind)?
} else {
let (val, overflowed) = self.binary_op(bin_op, l, r)?;
if overflowed {
let layout = self.layout_of(substs.type_at(0))?;
- let r_val = r.to_scalar()?.to_bits(layout.size)?;
- throw_unsup!(
- Intrinsic(format!("Overflowing shift by {} in {}", r_val, intrinsic_name))
- )
+ let r_val = r.to_scalar()?.to_bits(layout.size)?;
+ throw_ub_format!("Overflowing shift by {} in `{}`", r_val, intrinsic_name);
}
self.write_scalar(val, dest)?;
}
def_id: DefId,
) -> InterpResult<'tcx, Cow<'tcx, 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.
+ /// Called for all binary operations where the LHS has pointer type.
///
/// Returns a (value, overflowed) pair if the operation succeeded
- fn ptr_op(
+ fn binary_ptr_op(
ecx: &InterpCx<'mir, 'tcx, Self>,
bin_op: mir::BinOp,
left: ImmTy<'tcx, Self::PointerTag>,
extra: Self::FrameExtra,
) -> InterpResult<'tcx>;
- #[inline(always)]
fn int_to_ptr(
_mem: &Memory<'mir, 'tcx, Self>,
int: u64,
}).into())
}
- #[inline(always)]
fn ptr_to_int(
_mem: &Memory<'mir, 'tcx, Self>,
_ptr: Pointer<Self::PointerTag>,
- ) -> InterpResult<'tcx, u64> {
- throw_unsup!(ReadPointerAsBytes)
- }
+ ) -> InterpResult<'tcx, u64>;
}
match self {
FnVal::Instance(instance) =>
Ok(instance),
- FnVal::Other(_) => throw_unsup!(MachineError(format!(
- "Expected instance function pointer, got 'other' pointer"
- ))),
+ FnVal::Other(_) => throw_unsup_format!(
+ "'foreign' function pointers are not supported in this context"
+ ),
}
}
}
if (src.offset <= dest.offset && src.offset + size > dest.offset) ||
(dest.offset <= src.offset && dest.offset + size > src.offset)
{
- throw_unsup!(Intrinsic(
- "copy_nonoverlapping called on overlapping ranges".to_string(),
- ))
+ throw_ub_format!(
+ "copy_nonoverlapping called on overlapping ranges"
+ )
}
}
ScalarPair(ScalarMaybeUndef<Tag, Id>, ScalarMaybeUndef<Tag, Id>),
}
-impl<'tcx, Tag> Immediate<Tag> {
- #[inline]
- pub fn from_scalar(val: Scalar<Tag>) -> Self {
- Immediate::Scalar(ScalarMaybeUndef::Scalar(val))
+impl<Tag> From<ScalarMaybeUndef<Tag>> for Immediate<Tag> {
+ #[inline(always)]
+ fn from(val: ScalarMaybeUndef<Tag>) -> Self {
+ Immediate::Scalar(val)
}
+}
+impl<Tag> From<Scalar<Tag>> for Immediate<Tag> {
+ #[inline(always)]
+ fn from(val: Scalar<Tag>) -> Self {
+ Immediate::Scalar(val.into())
+ }
+}
+
+impl<'tcx, Tag> Immediate<Tag> {
pub fn new_slice(
val: Scalar<Tag>,
len: u64,
{
#[inline]
pub fn from_scalar(val: Scalar<Tag>, layout: TyLayout<'tcx>) -> Self {
- ImmTy { imm: Immediate::from_scalar(val), layout }
+ ImmTy { imm: val.into(), layout }
}
#[inline]
let ptr = match self.check_mplace_access(mplace, None)? {
Some(ptr) => ptr,
None => return Ok(Some(ImmTy { // zero-sized type
- imm: Immediate::Scalar(Scalar::zst().into()),
+ imm: Scalar::zst().into(),
layout: mplace.layout,
})),
};
.get(ptr.alloc_id)?
.read_scalar(self, ptr, mplace.layout.size)?;
Ok(Some(ImmTy {
- imm: Immediate::Scalar(scalar),
+ imm: scalar.into(),
layout: mplace.layout,
}))
}
let field = field.try_into().unwrap();
let field_layout = op.layout.field(self, field)?;
if field_layout.is_zst() {
- let immediate = Immediate::Scalar(Scalar::zst().into());
+ let immediate = Scalar::zst().into();
return Ok(OpTy { op: Operand::Immediate(immediate), layout: field_layout });
}
let offset = op.layout.fields.offset(field);
// extract fields from types with `ScalarPair` ABI
Immediate::ScalarPair(a, b) => {
let val = if offset.bytes() == 0 { a } else { b };
- Immediate::Scalar(val)
+ Immediate::from(val)
},
Immediate::Scalar(val) =>
bug!("field access on non aggregate {:#?}, {:#?}", val, op.layout),
Deref => self.deref_operand(base)?.into(),
Subslice { .. } | ConstantIndex { .. } | Index(_) => if base.layout.is_zst() {
OpTy {
- op: Operand::Immediate(Immediate::Scalar(Scalar::zst().into())),
+ op: Operand::Immediate(Scalar::zst().into()),
// the actual index doesn't matter, so we just pick a convenient one like 0
layout: base.layout.field(self, 0)?,
}
let layout = self.layout_of_local(frame, local, layout)?;
let op = if layout.is_zst() {
// Do not read from ZST, they might not be initialized
- Operand::Immediate(Immediate::Scalar(Scalar::zst().into()))
+ Operand::Immediate(Scalar::zst().into())
} else {
frame.locals[local].access()?
};
Operand::Indirect(MemPlace::from_ptr(ptr, align))
},
ConstValue::Scalar(x) =>
- Operand::Immediate(Immediate::Scalar(tag_scalar(x).into())),
+ Operand::Immediate(tag_scalar(x).into()),
ConstValue::Slice { data, start, end } => {
// We rely on mutability being set correctly in `data` to prevent writes
// where none should happen.
// For the remaining ops, the types must be the same on both sides
if left_layout.ty != right_layout.ty {
- let msg = format!(
- "unimplemented asymmetric binary op {:?}: {:?} ({:?}), {:?} ({:?})",
+ bug!(
+ "invalid asymmetric binary op {:?}: {:?} ({:?}), {:?} ({:?})",
bin_op,
- l,
- left_layout.ty,
- r,
- right_layout.ty
- );
- throw_unsup!(Unimplemented(msg))
+ l, left_layout.ty,
+ r, right_layout.ty,
+ )
}
// Operations that need special treatment for signed integers
}
_ => {
- let msg = format!(
- "unimplemented binary op {:?}: {:?}, {:?} (both {:?})",
+ bug!(
+ "invalid binary op {:?}: {:?}, {:?} (both {:?})",
bin_op,
l,
r,
right_layout.ty,
- );
- throw_unsup!(Unimplemented(msg))
+ )
}
};
FloatTy::F64 => self.binary_float_op(bin_op, left.to_f64()?, right.to_f64()?),
})
}
- _ => {
- // Must be integer(-like) types. Don't forget about == on fn pointers.
- assert!(
- left.layout.ty.is_integral() ||
- left.layout.ty.is_unsafe_ptr() || left.layout.ty.is_fn_ptr(),
- "Unexpected LHS type {:?} for BinOp {:?}", left.layout.ty, bin_op);
+ _ if left.layout.ty.is_integral() => {
+ // the RHS type can be different, e.g. for shifts -- but it has to be integral, too
assert!(
- right.layout.ty.is_integral() ||
- right.layout.ty.is_unsafe_ptr() || right.layout.ty.is_fn_ptr(),
- "Unexpected RHS type {:?} for BinOp {:?}", right.layout.ty, bin_op);
-
- // Handle operations that support pointer values
- if left.to_scalar_ptr()?.is_ptr() ||
- right.to_scalar_ptr()?.is_ptr() ||
- bin_op == mir::BinOp::Offset
- {
- return M::ptr_op(self, bin_op, left, right);
- }
+ right.layout.ty.is_integral(),
+ "Unexpected types for BinOp: {:?} {:?} {:?}",
+ left.layout.ty, bin_op, right.layout.ty
+ );
- // Everything else only works with "proper" bits
- let l = left.to_bits().expect("we checked is_ptr");
- let r = right.to_bits().expect("we checked is_ptr");
+ let l = self.force_bits(left.to_scalar()?, left.layout.size)?;
+ let r = self.force_bits(right.to_scalar()?, right.layout.size)?;
self.binary_int_op(bin_op, l, left.layout, r, right.layout)
}
+ _ if left.layout.ty.is_any_ptr() => {
+ // The RHS type must be the same *or an integer type* (for `Offset`).
+ assert!(
+ right.layout.ty == left.layout.ty || right.layout.ty.is_integral(),
+ "Unexpected types for BinOp: {:?} {:?} {:?}",
+ left.layout.ty, bin_op, right.layout.ty
+ );
+
+ M::binary_ptr_op(self, bin_op, left, right)
+ }
+ _ => bug!("Invalid MIR: bad LHS type for binop: {:?}", left.layout.ty),
}
}
// size of MIR constantly.
Nop => {}
- InlineAsm { .. } => throw_unsup!(InlineAsm),
+ InlineAsm { .. } => throw_unsup_format!("inline assembly is not supported"),
}
self.stack[frame_idx].stmt += 1;
use super::{
InterpResult, PointerArithmetic, Scalar,
- InterpCx, Machine, Immediate, OpTy, ImmTy, PlaceTy, MPlaceTy, StackPopCleanup, FnVal,
+ InterpCx, Machine, OpTy, ImmTy, PlaceTy, MPlaceTy, StackPopCleanup, FnVal,
};
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
(FnVal::Instance(self.resolve(def_id, substs)?), sig.abi())
},
_ => {
- let msg = format!("can't handle callee of type {:?}", func.layout.ty);
- throw_unsup!(Unimplemented(msg))
+ bug!("invalid callee of type {:?}", func.layout.ty)
}
};
let args = self.eval_operands(args)?;
// Adjust receiver argument.
args[0] = OpTy::from(ImmTy {
layout: this_receiver_ptr,
- imm: Immediate::Scalar(receiver_place.ptr.into())
+ imm: receiver_place.ptr.into()
});
trace!("Patched self operand to {:#?}", args[0]);
// recurse with concrete function
match diagnostic.error {
Exit(_) => bug!("the CTFE program cannot exit"),
Unsupported(_)
- | UndefinedBehaviour(_)
+ | UndefinedBehavior(_)
| InvalidProgram(_)
| ResourceExhaustion(_) => {
// Ignore these errors.
Inner,
}
-#[derive(
- Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, PartialOrd, Ord, Copy,
-)]
+#[derive(Clone, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, Copy)]
pub struct AttrId(pub usize);
impl Idx for AttrId {
}
}
+impl rustc_serialize::Encodable for AttrId {
+ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
+ s.emit_unit()
+ }
+}
+
+impl rustc_serialize::Decodable for AttrId {
+ fn decode<D: Decoder>(d: &mut D) -> Result<AttrId, D::Error> {
+ d.read_nil().map(|_| crate::attr::mk_attr_id())
+ }
+}
+
/// Metadata associated with an item.
/// Doc-comments are promoted to attributes that have `is_sugared_doc = true`.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
use crate::ast::{self, Attribute, MetaItem, NestedMetaItem};
use crate::early_buffered_lints::BufferedEarlyLintId;
use crate::ext::base::ExtCtxt;
-use crate::ext::build::AstBuilder;
use crate::feature_gate::{Features, GatedCfg};
use crate::parse::ParseSess;
pub fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaItem, name: Symbol) {
// All the built-in macro attributes are "words" at the moment.
let template = AttributeTemplate { word: true, list: None, name_value_str: None };
- let attr = ecx.attribute(meta_item.span, meta_item.clone());
+ let attr = ecx.attribute(meta_item.clone());
check_builtin_attribute(ecx.parse_sess, &attr, name, template);
}
pub use IntType::*;
pub use ReprAttr::*;
pub use StabilityLevel::*;
+pub use crate::ast::Attribute;
use crate::ast;
-use crate::ast::{AttrId, Attribute, AttrStyle, Name, Ident, Path, PathSegment};
+use crate::ast::{AttrId, AttrStyle, Name, Ident, Path, PathSegment};
use crate::ast::{MetaItem, MetaItemKind, NestedMetaItem};
use crate::ast::{Lit, LitKind, Expr, Item, Local, Stmt, StmtKind, GenericParam};
use crate::mut_visit::visit_clobber;
let meta = mk_name_value_item_str(
Ident::with_empty_ctxt(sym::doc),
dummy_spanned(Symbol::intern(&strip_doc_comment_decoration(&comment.as_str()))));
- let mut attr = if self.style == ast::AttrStyle::Outer {
- mk_attr_outer(self.span, self.id, meta)
- } else {
- mk_attr_inner(self.span, self.id, meta)
- };
- attr.is_sugared_doc = true;
- f(&attr)
+ f(&Attribute {
+ id: self.id,
+ style: self.style,
+ path: meta.path,
+ tokens: meta.node.tokens(meta.span),
+ is_sugared_doc: true,
+ span: self.span,
+ })
} else {
f(self)
}
AttrId(id)
}
-/// Returns an inner attribute with the given value.
-pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute {
- mk_spanned_attr_inner(span, id, item)
-}
-
/// Returns an inner attribute with the given value and span.
-pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute {
+pub fn mk_attr_inner(item: MetaItem) -> Attribute {
Attribute {
- id,
+ id: mk_attr_id(),
style: ast::AttrStyle::Inner,
path: item.path,
tokens: item.node.tokens(item.span),
is_sugared_doc: false,
- span: sp,
+ span: item.span,
}
}
-/// Returns an outer attribute with the given value.
-pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute {
- mk_spanned_attr_outer(span, id, item)
-}
-
/// Returns an outer attribute with the given value and span.
-pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute {
+pub fn mk_attr_outer(item: MetaItem) -> Attribute {
Attribute {
- id,
+ id: mk_attr_id(),
style: ast::AttrStyle::Outer,
path: item.path,
tokens: item.node.tokens(item.span),
is_sugared_doc: false,
- span: sp,
+ span: item.span,
}
}
-pub fn mk_sugared_doc_attr(id: AttrId, text: Symbol, span: Span) -> Attribute {
+pub fn mk_sugared_doc_attr(text: Symbol, span: Span) -> Attribute {
let style = doc_comment_style(&text.as_str());
let lit_kind = LitKind::Str(text, ast::StrStyle::Cooked);
let lit = Lit::from_lit_kind(lit_kind, span);
Attribute {
- id,
+ id: mk_attr_id(),
style,
path: Path::from_ident(Ident::with_empty_ctxt(sym::doc).with_span_pos(span)),
tokens: MetaItemKind::NameValue(lit).tokens(span),
use crate::ast::{self, Ident, Name};
use crate::source_map;
use crate::ext::base::{ExtCtxt, MacEager, MacResult};
-use crate::ext::build::AstBuilder;
use crate::parse::token::{self, Token};
use crate::ptr::P;
use crate::symbol::kw;
use rustc_target::spec::abi::Abi;
use syntax_pos::{Pos, Span};
-pub trait AstBuilder {
- // Paths
- fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path;
- fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path;
- fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path;
- fn path_all(&self, sp: Span,
- global: bool,
- idents: Vec<ast::Ident>,
- args: Vec<ast::GenericArg>,
- constraints: Vec<ast::AssocTyConstraint>)
- -> ast::Path;
-
- fn qpath(&self, self_type: P<ast::Ty>,
- trait_path: ast::Path,
- ident: ast::Ident)
- -> (ast::QSelf, ast::Path);
- fn qpath_all(&self, self_type: P<ast::Ty>,
- trait_path: ast::Path,
- ident: ast::Ident,
- args: Vec<ast::GenericArg>,
- constraints: Vec<ast::AssocTyConstraint>)
- -> (ast::QSelf, ast::Path);
-
- // types and consts
- fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy;
-
- fn ty(&self, span: Span, ty: ast::TyKind) -> P<ast::Ty>;
- fn ty_path(&self, path: ast::Path) -> P<ast::Ty>;
- fn ty_ident(&self, span: Span, idents: ast::Ident) -> P<ast::Ty>;
- fn anon_const(&self, span: Span, expr: ast::ExprKind) -> ast::AnonConst;
- fn const_ident(&self, span: Span, idents: ast::Ident) -> ast::AnonConst;
-
- fn ty_rptr(&self, span: Span,
- ty: P<ast::Ty>,
- lifetime: Option<ast::Lifetime>,
- mutbl: ast::Mutability) -> P<ast::Ty>;
- fn ty_ptr(&self, span: Span,
- ty: P<ast::Ty>,
- mutbl: ast::Mutability) -> P<ast::Ty>;
-
- fn ty_infer(&self, sp: Span) -> P<ast::Ty>;
-
- fn typaram(&self,
- span: Span,
- id: ast::Ident,
- attrs: Vec<ast::Attribute>,
- bounds: ast::GenericBounds,
- default: Option<P<ast::Ty>>) -> ast::GenericParam;
-
- fn trait_ref(&self, path: ast::Path) -> ast::TraitRef;
- fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef;
- fn trait_bound(&self, path: ast::Path) -> ast::GenericBound;
- fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime;
- fn lifetime_def(&self,
- span: Span,
- ident: ast::Ident,
- attrs: Vec<ast::Attribute>,
- bounds: ast::GenericBounds)
- -> ast::GenericParam;
-
- // Statements
- fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt;
- fn stmt_semi(&self, expr: P<ast::Expr>) -> ast::Stmt;
- fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident, ex: P<ast::Expr>) -> ast::Stmt;
- fn stmt_let_typed(&self,
- sp: Span,
- mutbl: bool,
- ident: ast::Ident,
- typ: P<ast::Ty>,
- ex: P<ast::Expr>)
- -> ast::Stmt;
- fn stmt_let_type_only(&self, span: Span, ty: P<ast::Ty>) -> ast::Stmt;
- fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> ast::Stmt;
-
- // Blocks
- fn block(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Block>;
- fn block_expr(&self, expr: P<ast::Expr>) -> P<ast::Block>;
-
- // Expressions
- fn expr(&self, span: Span, node: ast::ExprKind) -> P<ast::Expr>;
- fn expr_path(&self, path: ast::Path) -> P<ast::Expr>;
- fn expr_qpath(&self, span: Span, qself: ast::QSelf, path: ast::Path) -> P<ast::Expr>;
- fn expr_ident(&self, span: Span, id: ast::Ident) -> P<ast::Expr>;
-
- fn expr_self(&self, span: Span) -> P<ast::Expr>;
- fn expr_binary(&self, sp: Span, op: ast::BinOpKind,
- lhs: P<ast::Expr>, rhs: P<ast::Expr>) -> P<ast::Expr>;
- fn expr_deref(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr>;
- fn expr_unary(&self, sp: Span, op: ast::UnOp, e: P<ast::Expr>) -> P<ast::Expr>;
-
- fn expr_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr>;
- fn expr_mut_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr>;
- fn expr_field_access(&self, span: Span, expr: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr>;
- fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>,
- idx: usize) -> P<ast::Expr>;
- fn expr_call(&self, span: Span, expr: P<ast::Expr>, args: Vec<P<ast::Expr>>) -> P<ast::Expr>;
- fn expr_call_ident(&self, span: Span, id: ast::Ident, args: Vec<P<ast::Expr>>) -> P<ast::Expr>;
- fn expr_call_global(&self, sp: Span, fn_path: Vec<ast::Ident>,
- args: Vec<P<ast::Expr>> ) -> P<ast::Expr>;
- fn expr_method_call(&self, span: Span,
- expr: P<ast::Expr>, ident: ast::Ident,
- args: Vec<P<ast::Expr>> ) -> P<ast::Expr>;
- fn expr_block(&self, b: P<ast::Block>) -> P<ast::Expr>;
- fn expr_cast(&self, sp: Span, expr: P<ast::Expr>, ty: P<ast::Ty>) -> P<ast::Expr>;
-
- fn field_imm(&self, span: Span, name: Ident, e: P<ast::Expr>) -> ast::Field;
- fn expr_struct(&self, span: Span, path: ast::Path, fields: Vec<ast::Field>) -> P<ast::Expr>;
- fn expr_struct_ident(&self, span: Span, id: ast::Ident,
- fields: Vec<ast::Field>) -> P<ast::Expr>;
-
- fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P<ast::Expr>;
-
- fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
- fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr>;
- fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
- fn expr_u16(&self, sp: Span, u: u16) -> P<ast::Expr>;
- fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr>;
- fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
-
- fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr>;
- fn expr_vec_ng(&self, sp: Span) -> P<ast::Expr>;
- fn expr_vec_slice(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr>;
- fn expr_str(&self, sp: Span, s: Symbol) -> P<ast::Expr>;
-
- fn expr_some(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr>;
- fn expr_none(&self, sp: Span) -> P<ast::Expr>;
-
- fn expr_break(&self, sp: Span) -> P<ast::Expr>;
-
- fn expr_tuple(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr>;
-
- fn expr_fail(&self, span: Span, msg: Symbol) -> P<ast::Expr>;
- fn expr_unreachable(&self, span: Span) -> P<ast::Expr>;
-
- fn expr_ok(&self, span: Span, expr: P<ast::Expr>) -> P<ast::Expr>;
- fn expr_err(&self, span: Span, expr: P<ast::Expr>) -> P<ast::Expr>;
- fn expr_try(&self, span: Span, head: P<ast::Expr>) -> P<ast::Expr>;
-
- fn pat(&self, span: Span, pat: PatKind) -> P<ast::Pat>;
- fn pat_wild(&self, span: Span) -> P<ast::Pat>;
- fn pat_lit(&self, span: Span, expr: P<ast::Expr>) -> P<ast::Pat>;
- fn pat_ident(&self, span: Span, ident: ast::Ident) -> P<ast::Pat>;
-
- fn pat_ident_binding_mode(&self,
- span: Span,
- ident: ast::Ident,
- bm: ast::BindingMode) -> P<ast::Pat>;
- fn pat_path(&self, span: Span, path: ast::Path) -> P<ast::Pat>;
- fn pat_tuple_struct(&self, span: Span, path: ast::Path,
- subpats: Vec<P<ast::Pat>>) -> P<ast::Pat>;
- fn pat_struct(&self, span: Span, path: ast::Path,
- field_pats: Vec<Spanned<ast::FieldPat>>) -> P<ast::Pat>;
- fn pat_tuple(&self, span: Span, pats: Vec<P<ast::Pat>>) -> P<ast::Pat>;
-
- fn pat_some(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat>;
- fn pat_none(&self, span: Span) -> P<ast::Pat>;
-
- fn pat_ok(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat>;
- fn pat_err(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat>;
-
- fn arm(&self, span: Span, pats: Vec<P<ast::Pat>>, expr: P<ast::Expr>) -> ast::Arm;
- fn arm_unreachable(&self, span: Span) -> ast::Arm;
-
- fn expr_match(&self, span: Span, arg: P<ast::Expr>, arms: Vec<ast::Arm> ) -> P<ast::Expr>;
- fn expr_if(&self, span: Span,
- cond: P<ast::Expr>, then: P<ast::Expr>, els: Option<P<ast::Expr>>) -> P<ast::Expr>;
- fn expr_loop(&self, span: Span, block: P<ast::Block>) -> P<ast::Expr>;
-
- fn lambda_fn_decl(&self,
- span: Span,
- fn_decl: P<ast::FnDecl>,
- body: P<ast::Expr>,
- fn_decl_span: Span)
- -> P<ast::Expr>;
-
- fn lambda(&self, span: Span, ids: Vec<ast::Ident>, body: P<ast::Expr>) -> P<ast::Expr>;
- fn lambda0(&self, span: Span, body: P<ast::Expr>) -> P<ast::Expr>;
- fn lambda1(&self, span: Span, body: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr>;
-
- fn lambda_stmts(&self, span: Span, ids: Vec<ast::Ident>,
- blk: Vec<ast::Stmt>) -> P<ast::Expr>;
- fn lambda_stmts_0(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Expr>;
- fn lambda_stmts_1(&self, span: Span, stmts: Vec<ast::Stmt>,
- ident: ast::Ident) -> P<ast::Expr>;
-
- // Items
- fn item(&self, span: Span,
- name: Ident, attrs: Vec<ast::Attribute> , node: ast::ItemKind) -> P<ast::Item>;
-
- fn arg(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> ast::Arg;
- // FIXME: unused `self`
- fn fn_decl(&self, inputs: Vec<ast::Arg> , output: ast::FunctionRetTy) -> P<ast::FnDecl>;
-
- fn item_fn_poly(&self,
- span: Span,
- name: Ident,
- inputs: Vec<ast::Arg> ,
- output: P<ast::Ty>,
- generics: Generics,
- body: P<ast::Block>) -> P<ast::Item>;
- fn item_fn(&self,
- span: Span,
- name: Ident,
- inputs: Vec<ast::Arg> ,
- output: P<ast::Ty>,
- body: P<ast::Block>) -> P<ast::Item>;
-
- fn variant(&self, span: Span, name: Ident, tys: Vec<P<ast::Ty>> ) -> ast::Variant;
- fn item_enum_poly(&self,
- span: Span,
- name: Ident,
- enum_definition: ast::EnumDef,
- generics: Generics) -> P<ast::Item>;
- fn item_enum(&self, span: Span, name: Ident, enum_def: ast::EnumDef) -> P<ast::Item>;
-
- fn item_struct_poly(&self,
- span: Span,
- name: Ident,
- struct_def: ast::VariantData,
- generics: Generics) -> P<ast::Item>;
- fn item_struct(&self, span: Span, name: Ident, struct_def: ast::VariantData) -> P<ast::Item>;
-
- fn item_mod(&self, span: Span, inner_span: Span,
- name: Ident, attrs: Vec<ast::Attribute>,
- items: Vec<P<ast::Item>>) -> P<ast::Item>;
-
- fn item_extern_crate(&self, span: Span, name: Ident) -> P<ast::Item>;
-
- fn item_static(&self,
- span: Span,
- name: Ident,
- ty: P<ast::Ty>,
- mutbl: ast::Mutability,
- expr: P<ast::Expr>)
- -> P<ast::Item>;
-
- fn item_const(&self,
- span: Span,
- name: Ident,
- ty: P<ast::Ty>,
- expr: P<ast::Expr>)
- -> P<ast::Item>;
-
- fn item_ty_poly(&self,
- span: Span,
- name: Ident,
- ty: P<ast::Ty>,
- generics: Generics) -> P<ast::Item>;
- fn item_ty(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> P<ast::Item>;
-
- fn attribute(&self, sp: Span, mi: ast::MetaItem) -> ast::Attribute;
-
- fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem;
-
- fn meta_list_item_word(&self, sp: Span, w: ast::Name) -> ast::NestedMetaItem;
-
- fn meta_list(&self,
- sp: Span,
- name: ast::Name,
- mis: Vec<ast::NestedMetaItem> )
- -> ast::MetaItem;
- fn meta_name_value(&self,
- sp: Span,
- name: ast::Name,
- value: ast::LitKind)
- -> ast::MetaItem;
-
- fn item_use(&self, sp: Span,
- vis: ast::Visibility, vp: P<ast::UseTree>) -> P<ast::Item>;
- fn item_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> P<ast::Item>;
- fn item_use_simple_(&self, sp: Span, vis: ast::Visibility,
- ident: Option<ast::Ident>, path: ast::Path) -> P<ast::Item>;
- fn item_use_list(&self, sp: Span, vis: ast::Visibility,
- path: Vec<ast::Ident>, imports: &[ast::Ident]) -> P<ast::Item>;
- fn item_use_glob(&self, sp: Span,
- vis: ast::Visibility, path: Vec<ast::Ident>) -> P<ast::Item>;
-}
+// Left so that Cargo tests don't break, this can be removed once those no longer use it
+pub trait AstBuilder {}
-impl<'a> AstBuilder for ExtCtxt<'a> {
- fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
+impl<'a> ExtCtxt<'a> {
+ pub fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
self.path_all(span, false, strs, vec![], vec![])
}
- fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
+ pub fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
self.path(span, vec![id])
}
- fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
+ pub fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
self.path_all(span, true, strs, vec![], vec![])
}
- fn path_all(&self,
+ pub fn path_all(&self,
span: Span,
global: bool,
mut idents: Vec<ast::Ident> ,
/// Constructs a qualified path.
///
/// Constructs a path like `<self_type as trait_path>::ident`.
- fn qpath(&self,
+ pub fn qpath(&self,
self_type: P<ast::Ty>,
trait_path: ast::Path,
ident: ast::Ident)
/// Constructs a qualified path.
///
/// Constructs a path like `<self_type as trait_path>::ident<'a, T, A = Bar>`.
- fn qpath_all(&self,
+ pub fn qpath_all(&self,
self_type: P<ast::Ty>,
trait_path: ast::Path,
ident: ast::Ident,
}, path)
}
- fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy {
+ pub fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy {
ast::MutTy {
ty,
mutbl,
}
}
- fn ty(&self, span: Span, ty: ast::TyKind) -> P<ast::Ty> {
+ pub fn ty(&self, span: Span, ty: ast::TyKind) -> P<ast::Ty> {
P(ast::Ty {
id: ast::DUMMY_NODE_ID,
span,
})
}
- fn ty_path(&self, path: ast::Path) -> P<ast::Ty> {
+ pub fn ty_path(&self, path: ast::Path) -> P<ast::Ty> {
self.ty(path.span, ast::TyKind::Path(None, path))
}
// Might need to take bounds as an argument in the future, if you ever want
// to generate a bounded existential trait type.
- fn ty_ident(&self, span: Span, ident: ast::Ident)
+ pub fn ty_ident(&self, span: Span, ident: ast::Ident)
-> P<ast::Ty> {
self.ty_path(self.path_ident(span, ident))
}
- fn anon_const(&self, span: Span, expr: ast::ExprKind) -> ast::AnonConst {
+ pub fn anon_const(&self, span: Span, expr: ast::ExprKind) -> ast::AnonConst {
ast::AnonConst {
id: ast::DUMMY_NODE_ID,
value: P(ast::Expr {
}
}
- fn const_ident(&self, span: Span, ident: ast::Ident) -> ast::AnonConst {
+ pub fn const_ident(&self, span: Span, ident: ast::Ident) -> ast::AnonConst {
self.anon_const(span, ast::ExprKind::Path(None, self.path_ident(span, ident)))
}
- fn ty_rptr(&self,
+ pub fn ty_rptr(&self,
span: Span,
ty: P<ast::Ty>,
lifetime: Option<ast::Lifetime>,
ast::TyKind::Rptr(lifetime, self.ty_mt(ty, mutbl)))
}
- fn ty_ptr(&self,
+ pub fn ty_ptr(&self,
span: Span,
ty: P<ast::Ty>,
mutbl: ast::Mutability)
ast::TyKind::Ptr(self.ty_mt(ty, mutbl)))
}
- fn ty_infer(&self, span: Span) -> P<ast::Ty> {
+ pub fn ty_infer(&self, span: Span) -> P<ast::Ty> {
self.ty(span, ast::TyKind::Infer)
}
- fn typaram(&self,
+ pub fn typaram(&self,
span: Span,
ident: ast::Ident,
attrs: Vec<ast::Attribute>,
}
}
- fn trait_ref(&self, path: ast::Path) -> ast::TraitRef {
+ pub fn trait_ref(&self, path: ast::Path) -> ast::TraitRef {
ast::TraitRef {
path,
ref_id: ast::DUMMY_NODE_ID,
}
}
- fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef {
+ pub fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef {
ast::PolyTraitRef {
bound_generic_params: Vec::new(),
trait_ref: self.trait_ref(path),
}
}
- fn trait_bound(&self, path: ast::Path) -> ast::GenericBound {
+ pub fn trait_bound(&self, path: ast::Path) -> ast::GenericBound {
ast::GenericBound::Trait(self.poly_trait_ref(path.span, path),
ast::TraitBoundModifier::None)
}
- fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime {
+ pub fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime {
ast::Lifetime { id: ast::DUMMY_NODE_ID, ident: ident.with_span_pos(span) }
}
- fn lifetime_def(&self,
+ pub fn lifetime_def(&self,
span: Span,
ident: ast::Ident,
attrs: Vec<ast::Attribute>,
}
}
- fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt {
+ pub fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt {
ast::Stmt {
id: ast::DUMMY_NODE_ID,
span: expr.span,
}
}
- fn stmt_semi(&self, expr: P<ast::Expr>) -> ast::Stmt {
+ pub fn stmt_semi(&self, expr: P<ast::Expr>) -> ast::Stmt {
ast::Stmt {
id: ast::DUMMY_NODE_ID,
span: expr.span,
}
}
- fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident,
+ pub fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident,
ex: P<ast::Expr>) -> ast::Stmt {
let pat = if mutbl {
let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Mutable);
}
}
- fn stmt_let_typed(&self,
+ pub fn stmt_let_typed(&self,
sp: Span,
mutbl: bool,
ident: ast::Ident,
}
// Generates `let _: Type;`, which is usually used for type assertions.
- fn stmt_let_type_only(&self, span: Span, ty: P<ast::Ty>) -> ast::Stmt {
+ pub fn stmt_let_type_only(&self, span: Span, ty: P<ast::Ty>) -> ast::Stmt {
let local = P(ast::Local {
pat: self.pat_wild(span),
ty: Some(ty),
}
}
- fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> ast::Stmt {
+ pub fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> ast::Stmt {
ast::Stmt {
id: ast::DUMMY_NODE_ID,
node: ast::StmtKind::Item(item),
}
}
- fn block_expr(&self, expr: P<ast::Expr>) -> P<ast::Block> {
+ pub fn block_expr(&self, expr: P<ast::Expr>) -> P<ast::Block> {
self.block(expr.span, vec![ast::Stmt {
id: ast::DUMMY_NODE_ID,
span: expr.span,
node: ast::StmtKind::Expr(expr),
}])
}
- fn block(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Block> {
+ pub fn block(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Block> {
P(ast::Block {
stmts,
id: ast::DUMMY_NODE_ID,
})
}
- fn expr(&self, span: Span, node: ast::ExprKind) -> P<ast::Expr> {
+ pub fn expr(&self, span: Span, node: ast::ExprKind) -> P<ast::Expr> {
P(ast::Expr {
id: ast::DUMMY_NODE_ID,
node,
})
}
- fn expr_path(&self, path: ast::Path) -> P<ast::Expr> {
+ pub fn expr_path(&self, path: ast::Path) -> P<ast::Expr> {
self.expr(path.span, ast::ExprKind::Path(None, path))
}
/// Constructs a `QPath` expression.
- fn expr_qpath(&self, span: Span, qself: ast::QSelf, path: ast::Path) -> P<ast::Expr> {
+ pub fn expr_qpath(&self, span: Span, qself: ast::QSelf, path: ast::Path) -> P<ast::Expr> {
self.expr(span, ast::ExprKind::Path(Some(qself), path))
}
- fn expr_ident(&self, span: Span, id: ast::Ident) -> P<ast::Expr> {
+ pub fn expr_ident(&self, span: Span, id: ast::Ident) -> P<ast::Expr> {
self.expr_path(self.path_ident(span, id))
}
- fn expr_self(&self, span: Span) -> P<ast::Expr> {
+ pub fn expr_self(&self, span: Span) -> P<ast::Expr> {
self.expr_ident(span, Ident::with_empty_ctxt(kw::SelfLower))
}
- fn expr_binary(&self, sp: Span, op: ast::BinOpKind,
+ pub fn expr_binary(&self, sp: Span, op: ast::BinOpKind,
lhs: P<ast::Expr>, rhs: P<ast::Expr>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Binary(Spanned { node: op, span: sp }, lhs, rhs))
}
- fn expr_deref(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_deref(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
self.expr_unary(sp, UnOp::Deref, e)
}
- fn expr_unary(&self, sp: Span, op: ast::UnOp, e: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_unary(&self, sp: Span, op: ast::UnOp, e: P<ast::Expr>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Unary(op, e))
}
- fn expr_field_access(&self, sp: Span, expr: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr> {
+ pub fn expr_field_access(
+ &self, sp: Span, expr: P<ast::Expr>, ident: ast::Ident,
+ ) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Field(expr, ident.with_span_pos(sp)))
}
- fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>, idx: usize) -> P<ast::Expr> {
+ pub fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>, idx: usize) -> P<ast::Expr> {
let ident = Ident::from_str(&idx.to_string()).with_span_pos(sp);
self.expr(sp, ast::ExprKind::Field(expr, ident))
}
- fn expr_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::AddrOf(ast::Mutability::Immutable, e))
}
- fn expr_mut_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_mut_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::AddrOf(ast::Mutability::Mutable, e))
}
- fn expr_call(&self, span: Span, expr: P<ast::Expr>, args: Vec<P<ast::Expr>>) -> P<ast::Expr> {
+ pub fn expr_call(
+ &self, span: Span, expr: P<ast::Expr>, args: Vec<P<ast::Expr>>,
+ ) -> P<ast::Expr> {
self.expr(span, ast::ExprKind::Call(expr, args))
}
- fn expr_call_ident(&self, span: Span, id: ast::Ident,
+ pub fn expr_call_ident(&self, span: Span, id: ast::Ident,
args: Vec<P<ast::Expr>>) -> P<ast::Expr> {
self.expr(span, ast::ExprKind::Call(self.expr_ident(span, id), args))
}
- fn expr_call_global(&self, sp: Span, fn_path: Vec<ast::Ident> ,
+ pub fn expr_call_global(&self, sp: Span, fn_path: Vec<ast::Ident> ,
args: Vec<P<ast::Expr>> ) -> P<ast::Expr> {
let pathexpr = self.expr_path(self.path_global(sp, fn_path));
self.expr_call(sp, pathexpr, args)
}
- fn expr_method_call(&self, span: Span,
+ pub fn expr_method_call(&self, span: Span,
expr: P<ast::Expr>,
ident: ast::Ident,
mut args: Vec<P<ast::Expr>> ) -> P<ast::Expr> {
let segment = ast::PathSegment::from_ident(ident.with_span_pos(span));
self.expr(span, ast::ExprKind::MethodCall(segment, args))
}
- fn expr_block(&self, b: P<ast::Block>) -> P<ast::Expr> {
+ pub fn expr_block(&self, b: P<ast::Block>) -> P<ast::Expr> {
self.expr(b.span, ast::ExprKind::Block(b, None))
}
- fn field_imm(&self, span: Span, ident: Ident, e: P<ast::Expr>) -> ast::Field {
+ pub fn field_imm(&self, span: Span, ident: Ident, e: P<ast::Expr>) -> ast::Field {
ast::Field {
ident: ident.with_span_pos(span),
expr: e,
attrs: ThinVec::new(),
}
}
- fn expr_struct(&self, span: Span, path: ast::Path, fields: Vec<ast::Field>) -> P<ast::Expr> {
+ pub fn expr_struct(
+ &self, span: Span, path: ast::Path, fields: Vec<ast::Field>
+ ) -> P<ast::Expr> {
self.expr(span, ast::ExprKind::Struct(path, fields, None))
}
- fn expr_struct_ident(&self, span: Span,
+ pub fn expr_struct_ident(&self, span: Span,
id: ast::Ident, fields: Vec<ast::Field>) -> P<ast::Expr> {
self.expr_struct(span, self.path_ident(span, id), fields)
}
- fn expr_lit(&self, span: Span, lit_kind: ast::LitKind) -> P<ast::Expr> {
+ pub fn expr_lit(&self, span: Span, lit_kind: ast::LitKind) -> P<ast::Expr> {
let lit = ast::Lit::from_lit_kind(lit_kind, span);
self.expr(span, ast::ExprKind::Lit(lit))
}
- fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
+ pub fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
self.expr_lit(span, ast::LitKind::Int(i as u128,
ast::LitIntType::Unsigned(ast::UintTy::Usize)))
}
- fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> {
+ pub fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> {
if i < 0 {
let i = (-i) as u128;
let lit_ty = ast::LitIntType::Signed(ast::IntTy::Isize);
ast::LitIntType::Signed(ast::IntTy::Isize)))
}
}
- fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> {
+ pub fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitKind::Int(u as u128,
ast::LitIntType::Unsigned(ast::UintTy::U32)))
}
- fn expr_u16(&self, sp: Span, u: u16) -> P<ast::Expr> {
+ pub fn expr_u16(&self, sp: Span, u: u16) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitKind::Int(u as u128,
ast::LitIntType::Unsigned(ast::UintTy::U16)))
}
- fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
+ pub fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitKind::Int(u as u128, ast::LitIntType::Unsigned(ast::UintTy::U8)))
}
- fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> {
+ pub fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitKind::Bool(value))
}
- fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
+ pub fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Array(exprs))
}
- fn expr_vec_ng(&self, sp: Span) -> P<ast::Expr> {
+ pub fn expr_vec_ng(&self, sp: Span) -> P<ast::Expr> {
self.expr_call_global(sp, self.std_path(&[sym::vec, sym::Vec, sym::new]),
Vec::new())
}
- fn expr_vec_slice(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
+ pub fn expr_vec_slice(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
self.expr_addr_of(sp, self.expr_vec(sp, exprs))
}
- fn expr_str(&self, sp: Span, s: Symbol) -> P<ast::Expr> {
+ pub fn expr_str(&self, sp: Span, s: Symbol) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitKind::Str(s, ast::StrStyle::Cooked))
}
- fn expr_cast(&self, sp: Span, expr: P<ast::Expr>, ty: P<ast::Ty>) -> P<ast::Expr> {
+ pub fn expr_cast(&self, sp: Span, expr: P<ast::Expr>, ty: P<ast::Ty>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Cast(expr, ty))
}
- fn expr_some(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_some(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
let some = self.std_path(&[sym::option, sym::Option, sym::Some]);
self.expr_call_global(sp, some, vec![expr])
}
- fn expr_none(&self, sp: Span) -> P<ast::Expr> {
+ pub fn expr_none(&self, sp: Span) -> P<ast::Expr> {
let none = self.std_path(&[sym::option, sym::Option, sym::None]);
let none = self.path_global(sp, none);
self.expr_path(none)
}
- fn expr_break(&self, sp: Span) -> P<ast::Expr> {
+ pub fn expr_break(&self, sp: Span) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Break(None, None))
}
- fn expr_tuple(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
+ pub fn expr_tuple(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
self.expr(sp, ast::ExprKind::Tup(exprs))
}
- fn expr_fail(&self, span: Span, msg: Symbol) -> P<ast::Expr> {
+ pub fn expr_fail(&self, span: Span, msg: Symbol) -> P<ast::Expr> {
let loc = self.source_map().lookup_char_pos(span.lo());
let expr_file = self.expr_str(span, Symbol::intern(&loc.file.name.to_string()));
let expr_line = self.expr_u32(span, loc.line as u32);
expr_loc_ptr])
}
- fn expr_unreachable(&self, span: Span) -> P<ast::Expr> {
+ pub fn expr_unreachable(&self, span: Span) -> P<ast::Expr> {
self.expr_fail(span, Symbol::intern("internal error: entered unreachable code"))
}
- fn expr_ok(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_ok(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
let ok = self.std_path(&[sym::result, sym::Result, sym::Ok]);
self.expr_call_global(sp, ok, vec![expr])
}
- fn expr_err(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_err(&self, sp: Span, expr: P<ast::Expr>) -> P<ast::Expr> {
let err = self.std_path(&[sym::result, sym::Result, sym::Err]);
self.expr_call_global(sp, err, vec![expr])
}
- fn expr_try(&self, sp: Span, head: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn expr_try(&self, sp: Span, head: P<ast::Expr>) -> P<ast::Expr> {
let ok = self.std_path(&[sym::result, sym::Result, sym::Ok]);
let ok_path = self.path_global(sp, ok);
let err = self.std_path(&[sym::result, sym::Result, sym::Err]);
}
- fn pat(&self, span: Span, pat: PatKind) -> P<ast::Pat> {
+ pub fn pat(&self, span: Span, pat: PatKind) -> P<ast::Pat> {
P(ast::Pat { id: ast::DUMMY_NODE_ID, node: pat, span })
}
- fn pat_wild(&self, span: Span) -> P<ast::Pat> {
+ pub fn pat_wild(&self, span: Span) -> P<ast::Pat> {
self.pat(span, PatKind::Wild)
}
- fn pat_lit(&self, span: Span, expr: P<ast::Expr>) -> P<ast::Pat> {
+ pub fn pat_lit(&self, span: Span, expr: P<ast::Expr>) -> P<ast::Pat> {
self.pat(span, PatKind::Lit(expr))
}
- fn pat_ident(&self, span: Span, ident: ast::Ident) -> P<ast::Pat> {
+ pub fn pat_ident(&self, span: Span, ident: ast::Ident) -> P<ast::Pat> {
let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Immutable);
self.pat_ident_binding_mode(span, ident, binding_mode)
}
- fn pat_ident_binding_mode(&self,
+ pub fn pat_ident_binding_mode(&self,
span: Span,
ident: ast::Ident,
bm: ast::BindingMode) -> P<ast::Pat> {
let pat = PatKind::Ident(bm, ident.with_span_pos(span), None);
self.pat(span, pat)
}
- fn pat_path(&self, span: Span, path: ast::Path) -> P<ast::Pat> {
+ pub fn pat_path(&self, span: Span, path: ast::Path) -> P<ast::Pat> {
self.pat(span, PatKind::Path(None, path))
}
- fn pat_tuple_struct(&self, span: Span, path: ast::Path,
+ pub fn pat_tuple_struct(&self, span: Span, path: ast::Path,
subpats: Vec<P<ast::Pat>>) -> P<ast::Pat> {
self.pat(span, PatKind::TupleStruct(path, subpats))
}
- fn pat_struct(&self, span: Span, path: ast::Path,
+ pub fn pat_struct(&self, span: Span, path: ast::Path,
field_pats: Vec<Spanned<ast::FieldPat>>) -> P<ast::Pat> {
self.pat(span, PatKind::Struct(path, field_pats, false))
}
- fn pat_tuple(&self, span: Span, pats: Vec<P<ast::Pat>>) -> P<ast::Pat> {
+ pub fn pat_tuple(&self, span: Span, pats: Vec<P<ast::Pat>>) -> P<ast::Pat> {
self.pat(span, PatKind::Tuple(pats))
}
- fn pat_some(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
+ pub fn pat_some(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
let some = self.std_path(&[sym::option, sym::Option, sym::Some]);
let path = self.path_global(span, some);
self.pat_tuple_struct(span, path, vec![pat])
}
- fn pat_none(&self, span: Span) -> P<ast::Pat> {
+ pub fn pat_none(&self, span: Span) -> P<ast::Pat> {
let some = self.std_path(&[sym::option, sym::Option, sym::None]);
let path = self.path_global(span, some);
self.pat_path(span, path)
}
- fn pat_ok(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
+ pub fn pat_ok(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
let some = self.std_path(&[sym::result, sym::Result, sym::Ok]);
let path = self.path_global(span, some);
self.pat_tuple_struct(span, path, vec![pat])
}
- fn pat_err(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
+ pub fn pat_err(&self, span: Span, pat: P<ast::Pat>) -> P<ast::Pat> {
let some = self.std_path(&[sym::result, sym::Result, sym::Err]);
let path = self.path_global(span, some);
self.pat_tuple_struct(span, path, vec![pat])
}
- fn arm(&self, span: Span, pats: Vec<P<ast::Pat>>, expr: P<ast::Expr>) -> ast::Arm {
+ pub fn arm(&self, span: Span, pats: Vec<P<ast::Pat>>, expr: P<ast::Expr>) -> ast::Arm {
ast::Arm {
attrs: vec![],
pats,
}
}
- fn arm_unreachable(&self, span: Span) -> ast::Arm {
+ pub fn arm_unreachable(&self, span: Span) -> ast::Arm {
self.arm(span, vec![self.pat_wild(span)], self.expr_unreachable(span))
}
- fn expr_match(&self, span: Span, arg: P<ast::Expr>, arms: Vec<ast::Arm>) -> P<Expr> {
+ pub fn expr_match(&self, span: Span, arg: P<ast::Expr>, arms: Vec<ast::Arm>) -> P<Expr> {
self.expr(span, ast::ExprKind::Match(arg, arms))
}
- fn expr_if(&self, span: Span, cond: P<ast::Expr>,
+ pub fn expr_if(&self, span: Span, cond: P<ast::Expr>,
then: P<ast::Expr>, els: Option<P<ast::Expr>>) -> P<ast::Expr> {
let els = els.map(|x| self.expr_block(self.block_expr(x)));
self.expr(span, ast::ExprKind::If(cond, self.block_expr(then), els))
}
- fn expr_loop(&self, span: Span, block: P<ast::Block>) -> P<ast::Expr> {
+ pub fn expr_loop(&self, span: Span, block: P<ast::Block>) -> P<ast::Expr> {
self.expr(span, ast::ExprKind::Loop(block, None))
}
- fn lambda_fn_decl(&self,
+ pub fn lambda_fn_decl(&self,
span: Span,
fn_decl: P<ast::FnDecl>,
body: P<ast::Expr>,
fn_decl_span))
}
- fn lambda(&self,
+ pub fn lambda(&self,
span: Span,
ids: Vec<ast::Ident>,
body: P<ast::Expr>)
span))
}
- fn lambda0(&self, span: Span, body: P<ast::Expr>) -> P<ast::Expr> {
+ pub fn lambda0(&self, span: Span, body: P<ast::Expr>) -> P<ast::Expr> {
self.lambda(span, Vec::new(), body)
}
- fn lambda1(&self, span: Span, body: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr> {
+ pub fn lambda1(&self, span: Span, body: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr> {
self.lambda(span, vec![ident], body)
}
- fn lambda_stmts(&self,
+ pub fn lambda_stmts(&self,
span: Span,
ids: Vec<ast::Ident>,
stmts: Vec<ast::Stmt>)
-> P<ast::Expr> {
self.lambda(span, ids, self.expr_block(self.block(span, stmts)))
}
- fn lambda_stmts_0(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Expr> {
+ pub fn lambda_stmts_0(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Expr> {
self.lambda0(span, self.expr_block(self.block(span, stmts)))
}
- fn lambda_stmts_1(&self, span: Span, stmts: Vec<ast::Stmt>,
+ pub fn lambda_stmts_1(&self, span: Span, stmts: Vec<ast::Stmt>,
ident: ast::Ident) -> P<ast::Expr> {
self.lambda1(span, self.expr_block(self.block(span, stmts)), ident)
}
- fn arg(&self, span: Span, ident: ast::Ident, ty: P<ast::Ty>) -> ast::Arg {
+ pub fn arg(&self, span: Span, ident: ast::Ident, ty: P<ast::Ty>) -> ast::Arg {
let arg_pat = self.pat_ident(span, ident);
ast::Arg {
attrs: ThinVec::default(),
}
// FIXME: unused `self`
- fn fn_decl(&self, inputs: Vec<ast::Arg>, output: ast::FunctionRetTy) -> P<ast::FnDecl> {
+ pub fn fn_decl(&self, inputs: Vec<ast::Arg>, output: ast::FunctionRetTy) -> P<ast::FnDecl> {
P(ast::FnDecl {
inputs,
output,
})
}
- fn item(&self, span: Span, name: Ident,
+ pub fn item(&self, span: Span, name: Ident,
attrs: Vec<ast::Attribute>, node: ast::ItemKind) -> P<ast::Item> {
// FIXME: Would be nice if our generated code didn't violate
// Rust coding conventions
})
}
- fn item_fn_poly(&self,
+ pub fn item_fn_poly(&self,
span: Span,
name: Ident,
inputs: Vec<ast::Arg> ,
body))
}
- fn item_fn(&self,
+ pub fn item_fn(&self,
span: Span,
name: Ident,
inputs: Vec<ast::Arg> ,
body)
}
- fn variant(&self, span: Span, ident: Ident, tys: Vec<P<ast::Ty>> ) -> ast::Variant {
+ pub fn variant(&self, span: Span, ident: Ident, tys: Vec<P<ast::Ty>> ) -> ast::Variant {
let fields: Vec<_> = tys.into_iter().map(|ty| {
ast::StructField {
span: ty.span,
})
}
- fn item_enum_poly(&self, span: Span, name: Ident,
+ pub fn item_enum_poly(&self, span: Span, name: Ident,
enum_definition: ast::EnumDef,
generics: Generics) -> P<ast::Item> {
self.item(span, name, Vec::new(), ast::ItemKind::Enum(enum_definition, generics))
}
- fn item_enum(&self, span: Span, name: Ident,
+ pub fn item_enum(&self, span: Span, name: Ident,
enum_definition: ast::EnumDef) -> P<ast::Item> {
self.item_enum_poly(span, name, enum_definition,
Generics::default())
}
- fn item_struct(&self, span: Span, name: Ident,
+ pub fn item_struct(&self, span: Span, name: Ident,
struct_def: ast::VariantData) -> P<ast::Item> {
self.item_struct_poly(
span,
)
}
- fn item_struct_poly(&self, span: Span, name: Ident,
+ pub fn item_struct_poly(&self, span: Span, name: Ident,
struct_def: ast::VariantData, generics: Generics) -> P<ast::Item> {
self.item(span, name, Vec::new(), ast::ItemKind::Struct(struct_def, generics))
}
- fn item_mod(&self, span: Span, inner_span: Span, name: Ident,
+ pub fn item_mod(&self, span: Span, inner_span: Span, name: Ident,
attrs: Vec<ast::Attribute>,
items: Vec<P<ast::Item>>) -> P<ast::Item> {
self.item(
)
}
- fn item_extern_crate(&self, span: Span, name: Ident) -> P<ast::Item> {
+ pub fn item_extern_crate(&self, span: Span, name: Ident) -> P<ast::Item> {
self.item(span, name, Vec::new(), ast::ItemKind::ExternCrate(None))
}
- fn item_static(&self,
+ pub fn item_static(&self,
span: Span,
name: Ident,
ty: P<ast::Ty>,
self.item(span, name, Vec::new(), ast::ItemKind::Static(ty, mutbl, expr))
}
- fn item_const(&self,
+ pub fn item_const(&self,
span: Span,
name: Ident,
ty: P<ast::Ty>,
self.item(span, name, Vec::new(), ast::ItemKind::Const(ty, expr))
}
- fn item_ty_poly(&self, span: Span, name: Ident, ty: P<ast::Ty>,
+ pub fn item_ty_poly(&self, span: Span, name: Ident, ty: P<ast::Ty>,
generics: Generics) -> P<ast::Item> {
self.item(span, name, Vec::new(), ast::ItemKind::Ty(ty, generics))
}
- fn item_ty(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> P<ast::Item> {
+ pub fn item_ty(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> P<ast::Item> {
self.item_ty_poly(span, name, ty, Generics::default())
}
- fn attribute(&self, sp: Span, mi: ast::MetaItem) -> ast::Attribute {
- attr::mk_spanned_attr_outer(sp, attr::mk_attr_id(), mi)
+ pub fn attribute(&self, mi: ast::MetaItem) -> ast::Attribute {
+ attr::mk_attr_outer(mi)
}
- fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {
- attr::mk_word_item(Ident::with_empty_ctxt(w).with_span_pos(sp))
+ pub fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {
+ attr::mk_word_item(Ident::new(w, sp))
}
- fn meta_list_item_word(&self, sp: Span, w: ast::Name) -> ast::NestedMetaItem {
- attr::mk_nested_word_item(Ident::with_empty_ctxt(w).with_span_pos(sp))
+ pub fn meta_list_item_word(&self, sp: Span, w: ast::Name) -> ast::NestedMetaItem {
+ attr::mk_nested_word_item(Ident::new(w, sp))
}
- fn meta_list(&self, sp: Span, name: ast::Name, mis: Vec<ast::NestedMetaItem>)
+ pub fn meta_list(&self, sp: Span, name: ast::Name, mis: Vec<ast::NestedMetaItem>)
-> ast::MetaItem {
- attr::mk_list_item(sp, Ident::with_empty_ctxt(name).with_span_pos(sp), mis)
+ attr::mk_list_item(sp, Ident::new(name, sp), mis)
}
- fn meta_name_value(&self, span: Span, name: ast::Name, lit_kind: ast::LitKind)
+ pub fn meta_name_value(&self, span: Span, name: ast::Name, lit_kind: ast::LitKind)
-> ast::MetaItem {
- attr::mk_name_value_item(span, Ident::with_empty_ctxt(name).with_span_pos(span),
+ attr::mk_name_value_item(span, Ident::new(name, span),
lit_kind, span)
}
- fn item_use(&self, sp: Span,
+ pub fn item_use(&self, sp: Span,
vis: ast::Visibility, vp: P<ast::UseTree>) -> P<ast::Item> {
P(ast::Item {
id: ast::DUMMY_NODE_ID,
})
}
- fn item_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> P<ast::Item> {
+ pub fn item_use_simple(&self, sp: Span, vis: ast::Visibility, path: ast::Path) -> P<ast::Item> {
self.item_use_simple_(sp, vis, None, path)
}
- fn item_use_simple_(&self, sp: Span, vis: ast::Visibility,
+ pub fn item_use_simple_(&self, sp: Span, vis: ast::Visibility,
rename: Option<ast::Ident>, path: ast::Path) -> P<ast::Item> {
self.item_use(sp, vis, P(ast::UseTree {
span: sp,
}))
}
- fn item_use_list(&self, sp: Span, vis: ast::Visibility,
+ pub fn item_use_list(&self, sp: Span, vis: ast::Visibility,
path: Vec<ast::Ident>, imports: &[ast::Ident]) -> P<ast::Item> {
let imports = imports.iter().map(|id| {
(ast::UseTree {
}))
}
- fn item_use_glob(&self, sp: Span,
+ pub fn item_use_glob(&self, sp: Span,
vis: ast::Visibility, path: Vec<ast::Ident>) -> P<ast::Item> {
self.item_use(sp, vis, P(ast::UseTree {
span: sp,
}
let meta = attr::mk_list_item(DUMMY_SP, Ident::with_empty_ctxt(sym::doc), items);
- match at.style {
- ast::AttrStyle::Inner => *at = attr::mk_spanned_attr_inner(at.span, at.id, meta),
- ast::AttrStyle::Outer => *at = attr::mk_spanned_attr_outer(at.span, at.id, meta),
- }
+ *at = attr::Attribute {
+ span: at.span,
+ id: at.id,
+ style: at.style,
+ path: meta.path,
+ tokens: meta.node.tokens(meta.span),
+ is_sugared_doc: false,
+ };
} else {
noop_visit_attribute(at, self)
}
use crate::attr::{mark_used, mark_known, HasAttrs};
use crate::errors::{Applicability, FatalError};
use crate::ext::base::{self, *};
-use crate::ext::build::AstBuilder;
use crate::ext::proc_macro_server;
use crate::parse::{self, token};
use crate::parse::parser::PathStyle;
item.visit_attrs(|attrs| {
if names.contains(&sym::Eq) && names.contains(&sym::PartialEq) {
let meta = cx.meta_word(span, sym::structural_match);
- attrs.push(cx.attribute(span, meta));
+ attrs.push(cx.attribute(meta));
}
if names.contains(&sym::Copy) {
let meta = cx.meta_word(span, sym::rustc_copy_clone_marker);
- attrs.push(cx.attribute(span, meta));
+ attrs.push(cx.attribute(meta));
}
});
}
}
// Checks that `matcher` is internally consistent and that it
-// can legally by followed by a token N, for all N in `follow`.
+// can legally be followed by a token `N`, for all `N` in `follow`.
// (If `follow` is empty, then it imposes no constraint on
// the `matcher`.)
//
let open_span = if span.is_dummy() {
span
} else {
- span.with_lo(span.lo() + BytePos(self.delim.len() as u32))
+ span.with_hi(span.lo() + BytePos(self.delim.len() as u32))
};
TokenTree::token(token::OpenDelim(self.delim), open_span)
}
just_parsed_doc_comment = false;
}
token::DocComment(s) => {
- let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), s, self.token.span);
+ let attr = attr::mk_sugared_doc_attr(s, self.token.span);
if attr.style != ast::AttrStyle::Outer {
let mut err = self.fatal("expected outer doc comment");
err.note("inner doc comments like this (starting with \
}
token::DocComment(s) => {
// we need to get the position of this token before we bump.
- let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), s, self.token.span);
+ let attr = attr::mk_sugared_doc_attr(s, self.token.span);
if attr.style == ast::AttrStyle::Inner {
attrs.push(attr);
self.bump();
self.eval_src_mod(path, directory_ownership, id.to_string(), id_span)?;
// Record that we fetched the mod from an external file
if warn {
- let attr = Attribute {
- id: attr::mk_attr_id(),
- style: ast::AttrStyle::Outer,
- path: ast::Path::from_ident(
- Ident::with_empty_ctxt(sym::warn_directory_ownership)),
- tokens: TokenStream::empty(),
- is_sugared_doc: false,
- span: DUMMY_SP,
- };
+ let attr = attr::mk_attr_outer(
+ attr::mk_word_item(Ident::with_empty_ctxt(sym::warn_directory_ownership)));
attr::mark_known(&attr);
attrs.push(attr);
}
let pi_nested = attr::mk_nested_word_item(ast::Ident::with_empty_ctxt(sym::prelude_import));
let list = attr::mk_list_item(
DUMMY_SP, ast::Ident::with_empty_ctxt(sym::feature), vec![pi_nested]);
- let fake_attr = attr::mk_attr_inner(DUMMY_SP, attr::mk_attr_id(), list);
+ let fake_attr = attr::mk_attr_inner(list);
s.print_attribute(&fake_attr);
// #![no_std]
let no_std_meta = attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::no_std));
- let fake_attr = attr::mk_attr_inner(DUMMY_SP, attr::mk_attr_id(), no_std_meta);
+ let fake_attr = attr::mk_attr_inner(no_std_meta);
s.print_attribute(&fake_attr);
}
use syntax::ast::{self, *};
use syntax::source_map::Spanned;
use syntax::ext::base::*;
-use syntax::ext::build::AstBuilder;
use syntax::parse::token::{self, TokenKind};
use syntax::parse::parser::Parser;
use syntax::print::pprust;
use syntax::ast;
use syntax::ext::base::{self, *};
-use syntax::ext::build::AstBuilder;
use syntax::attr;
use syntax::tokenstream;
use syntax::parse::token;
use syntax::ast;
use syntax::ext::base;
-use syntax::ext::build::AstBuilder;
use syntax::symbol::Symbol;
use syntax::tokenstream;
use syntax::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData};
use syntax::attr;
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::{kw, sym, Symbol};
use syntax_pos::Span;
}
let inline = cx.meta_word(span, sym::inline);
- let attrs = vec![cx.attribute(span, inline)];
+ let attrs = vec![cx.attribute(inline)];
let trait_def = TraitDef {
span,
attributes: Vec::new(),
use syntax::ast::{self, Expr, MetaItem, GenericArg};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::{sym, Symbol};
use syntax_pos::Span;
let inline = cx.meta_word(span, sym::inline);
let hidden = cx.meta_list_item_word(span, sym::hidden);
let doc = cx.meta_list(span, sym::doc, vec![hidden]);
- let attrs = vec![cx.attribute(span, inline), cx.attribute(span, doc)];
+ let attrs = vec![cx.attribute(inline), cx.attribute(doc)];
let trait_def = TraitDef {
span,
attributes: Vec::new(),
use syntax::ast::{self, Expr, MetaItem};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::sym;
use syntax_pos::Span;
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
let inline = cx.meta_word(span, sym::inline);
- let attrs = vec![cx.attribute(span, inline)];
+ let attrs = vec![cx.attribute(inline)];
let trait_def = TraitDef {
span,
attributes: Vec::new(),
use syntax::ast::{BinOpKind, Expr, MetaItem};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::sym;
use syntax_pos::Span;
macro_rules! md {
($name:expr, $f:ident) => { {
let inline = cx.meta_word(span, sym::inline);
- let attrs = vec![cx.attribute(span, inline)];
+ let attrs = vec![cx.attribute(inline)];
MethodDef {
name: $name,
generics: LifetimeBounds::empty(),
use syntax::ast::{self, BinOpKind, Expr, MetaItem};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::{sym, Symbol};
use syntax_pos::Span;
macro_rules! md {
($name:expr, $op:expr, $equal:expr) => { {
let inline = cx.meta_word(span, sym::inline);
- let attrs = vec![cx.attribute(span, inline)];
+ let attrs = vec![cx.attribute(inline)];
MethodDef {
name: $name,
generics: LifetimeBounds::empty(),
PathKind::Std));
let inline = cx.meta_word(span, sym::inline);
- let attrs = vec![cx.attribute(span, inline)];
+ let attrs = vec![cx.attribute(inline)];
let partial_cmp_def = MethodDef {
name: "partial_cmp",
use syntax::ast::{self, Ident};
use syntax::ast::{Expr, MetaItem};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::sym;
use syntax_pos::{DUMMY_SP, Span};
use syntax::ast;
use syntax::ast::{Expr, MetaItem, Mutability};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::Symbol;
use syntax_pos::Span;
use syntax::ast::{Expr, MetaItem};
use syntax::ext::base::{Annotatable, DummyResult, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::{kw, sym};
use syntax::span_err;
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
let inline = cx.meta_word(span, sym::inline);
- let attrs = vec![cx.attribute(span, inline)];
+ let attrs = vec![cx.attribute(inline)];
let trait_def = TraitDef {
span,
attributes: Vec::new(),
use syntax::ast::{Expr, ExprKind, MetaItem, Mutability};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::Symbol;
use syntax_pos::Span;
use syntax::ast::{VariantData, GenericParamKind, GenericArg};
use syntax::attr;
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::source_map::{self, respan};
use syntax::util::map_in_place::MapInPlace;
use syntax::ptr::P;
let path = cx.path_all(self.span, false, vec![type_ident], self_params, vec![]);
let self_type = cx.ty_path(path);
- let attr = cx.attribute(self.span,
- cx.meta_word(self.span, sym::automatically_derived));
+ let attr = cx.attribute(cx.meta_word(self.span, sym::automatically_derived));
// Just mark it now since we know that it'll end up used downstream
attr::mark_used(&attr);
let opt_trait_ref = Some(trait_ref);
let unused_qual = {
let word = cx.meta_list_item_word(self.span, Symbol::intern("unused_qualifications"));
- cx.attribute(self.span, cx.meta_list(self.span, sym::allow, vec![word]))
+ cx.attribute(cx.meta_list(self.span, sym::allow, vec![word]))
};
let mut a = vec![attr, unused_qual];
use syntax::ast::{self, Expr, GenericParamKind, Generics, Ident, SelfKind, GenericArg};
use syntax::ext::base::ExtCtxt;
-use syntax::ext::build::AstBuilder;
use syntax::source_map::{respan, DUMMY_SP};
use syntax::ptr::P;
use syntax_pos::Span;
use syntax::ast::{Expr, MetaItem, Mutability};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::sym;
use syntax_pos::Span;
use syntax::ast::{self, MetaItem};
use syntax::ext::base::{Annotatable, ExtCtxt, MultiItemModifier};
-use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
use syntax::symbol::{Symbol, sym};
use syntax_pos::Span;
use syntax::ast::{self, Ident, GenericArg};
use syntax::ext::base::{self, *};
-use syntax::ext::build::AstBuilder;
use syntax::symbol::{kw, sym, Symbol};
use syntax_pos::Span;
use syntax::tokenstream;
use syntax::ast;
use syntax::ext::base::{self, *};
-use syntax::ext::build::AstBuilder;
use syntax::parse::token;
use syntax::ptr::P;
use syntax::symbol::{Symbol, sym};
use syntax::attr::check_builtin_macro_attribute;
use syntax::ext::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS};
use syntax::ext::base::{Annotatable, ExtCtxt};
-use syntax::ext::build::AstBuilder;
use syntax::ext::hygiene::SyntaxContext;
use syntax::ptr::P;
use syntax::symbol::{kw, sym, Symbol};
fn attrs(&self) -> Vec<Attribute> {
let special = sym::rustc_std_internal_symbol;
let special = self.cx.meta_word(self.span, special);
- vec![self.cx.attribute(self.span, special)]
+ vec![self.cx.attribute(special)]
}
fn arg_ty(
use std::mem;
fn plugin_macro_def(name: Name, span: Span) -> P<Item> {
- let rustc_builtin_macro = Attribute {
- id: attr::mk_attr_id(),
- style: AttrStyle::Outer,
- path: Path::from_ident(Ident::new(sym::rustc_builtin_macro, span)),
- tokens: TokenStream::empty(),
- is_sugared_doc: false,
- span,
- };
+ let rustc_builtin_macro = attr::mk_attr_outer(
+ attr::mk_word_item(Ident::new(sym::rustc_builtin_macro, span)));
let parens: TreeAndJoint = TokenTree::Delimited(
DelimSpan::from_single(span), token::Paren, TokenStream::empty()
use syntax::attr;
use syntax::source_map::{ExpnInfo, ExpnKind, respan};
use syntax::ext::base::{ExtCtxt, MacroKind};
-use syntax::ext::build::AstBuilder;
use syntax::ext::expand::ExpansionConfig;
use syntax::ext::hygiene::ExpnId;
use syntax::ext::proc_macro::is_proc_macro_attr;
let hidden = cx.meta_list_item_word(span, sym::hidden);
let doc = cx.meta_list(span, sym::doc, vec![hidden]);
- let doc_hidden = cx.attribute(span, doc);
+ let doc_hidden = cx.attribute(doc);
let proc_macro = Ident::with_empty_ctxt(sym::proc_macro);
let krate = cx.item(span,
cx.expr_vec_slice(span, decls),
).map(|mut i| {
let attr = cx.meta_word(span, sym::rustc_proc_macro_decls);
- i.attrs.push(cx.attribute(span, attr));
+ i.attrs.push(cx.attribute(attr));
i.vis = respan(span, ast::VisibilityKind::Public);
i
});
use syntax::{ast, panictry};
use syntax::ext::base::{self, *};
-use syntax::ext::build::AstBuilder;
use syntax::parse::{self, token, DirectoryOwnership};
use syntax::print::pprust;
use syntax::ptr::P;
use syntax::ptr::P;
use syntax::source_map::{ExpnInfo, ExpnKind, dummy_spanned, respan};
use syntax::symbol::{Ident, Symbol, kw, sym};
-use syntax::tokenstream::TokenStream;
use syntax_pos::DUMMY_SP;
use std::iter;
};
krate.module.items.insert(0, P(ast::Item {
attrs: vec![attr::mk_attr_outer(
- DUMMY_SP,
- attr::mk_attr_id(),
attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::macro_use))
)],
vis: dummy_spanned(ast::VisibilityKind::Inherited),
));
krate.module.items.insert(0, P(ast::Item {
- attrs: vec![ast::Attribute {
- style: ast::AttrStyle::Outer,
- path: ast::Path::from_ident(ast::Ident::new(sym::prelude_import, span)),
- tokens: TokenStream::empty(),
- id: attr::mk_attr_id(),
- is_sugared_doc: false,
- span,
- }],
+ attrs: vec![attr::mk_attr_outer(
+ attr::mk_word_item(ast::Ident::new(sym::prelude_import, span)))],
vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
node: ast::ItemKind::Use(P(ast::UseTree {
prefix: ast::Path {
use syntax::ast;
use syntax::attr::{self, check_builtin_macro_attribute};
use syntax::ext::base::*;
-use syntax::ext::build::AstBuilder;
use syntax::ext::hygiene::SyntaxContext;
use syntax::print::pprust;
use syntax::source_map::respan;
item.vis = respan(item.vis.span, ast::VisibilityKind::Public);
item.ident = item.ident.gensym();
item.attrs.push(
- ecx.attribute(sp,
- ecx.meta_word(sp, sym::rustc_test_marker))
+ ecx.attribute(ecx.meta_word(sp, sym::rustc_test_marker))
);
item
});
let mut test_const = cx.item(sp, ast::Ident::new(item.ident.name, sp).gensym(),
vec![
// #[cfg(test)]
- cx.attribute(attr_sp, cx.meta_list(attr_sp, sym::cfg, vec![
+ cx.attribute(cx.meta_list(attr_sp, sym::cfg, vec![
cx.meta_list_item_word(attr_sp, sym::test)
])),
// #[rustc_test_marker]
- cx.attribute(attr_sp, cx.meta_word(attr_sp, sym::rustc_test_marker)),
+ cx.attribute(cx.meta_word(attr_sp, sym::rustc_test_marker)),
],
// const $ident: test::TestDescAndFn =
ast::ItemKind::Const(cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
use syntax::attr;
use syntax::entry::{self, EntryPointType};
use syntax::ext::base::{ExtCtxt, Resolver};
-use syntax::ext::build::AstBuilder;
use syntax::ext::expand::ExpansionConfig;
use syntax::ext::hygiene::{ExpnId, MacroKind};
use syntax::feature_gate::Features;
let dc_nested = attr::mk_nested_word_item(Ident::from_str("dead_code"));
let allow_dead_code_item = attr::mk_list_item(DUMMY_SP, allow_ident,
vec![dc_nested]);
- let allow_dead_code = attr::mk_attr_outer(DUMMY_SP,
- attr::mk_attr_id(),
- allow_dead_code_item);
+ let allow_dead_code = attr::mk_attr_outer(allow_dead_code_item);
ast::Item {
id,
// #![main]
let main_meta = ecx.meta_word(sp, sym::main);
- let main_attr = ecx.attribute(sp, main_meta);
+ let main_attr = ecx.attribute(main_meta);
// extern crate test as test_gensym
let test_extern_stmt = ecx.stmt_item(sp, ecx.item(sp,
// _3 = const Scalar(AllocId(1).0x0) : fn();
// _2 = move _3 as usize (Misc);
// ...
-// _1 = const Scalar(AllocId(1).0x0) : *const fn();
+// _1 = move _2 as *const fn() (Misc);
// ...
// }
// END rustc.main.ConstProp.after.mir
use std::borrow::ToOwned;
use syntax::ast;
-use syntax::ext::build::AstBuilder;
use syntax::ext::base::{SyntaxExtension, SyntaxExtensionKind};
use syntax::ext::base::{TTMacroExpander, ExtCtxt, MacResult, MacEager};
use syntax::print::pprust;
use syntax::parse::token::{self, 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_pos::Span;
use rustc_plugin::Registry;
-warning[E0507]: cannot move out of `foo` in pattern guard
- --> $DIR/borrowck-migrate-to-nll.rs:26:18
+warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-migrate-to-nll.rs:28:21
|
-LL | (|| { let bar = foo; bar.take() })();
- | ^^ ---
- | | |
- | | move occurs because `foo` has type `&mut std::option::Option<&i32>`, which does not implement the `Copy` trait
- | | move occurs due to use in closure
- | move out of `foo` occurs here
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p: &'a u8 = &*block.current;
+ | ^^^^^^^^^^^^^^^ immutable borrow occurs here
+LL | // (use `x` and `p` so enabling NLL doesn't assign overly short lifetimes)
+LL | drop(x);
+ | - mutable borrow later used here
|
- = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
= 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
= note: for more information, try `rustc --explain E0729`
-// This is a test of the borrowck migrate mode. It leverages #27282, a
+// This is a test of the borrowck migrate mode. It leverages #38899, a
// bug that is fixed by NLL: this code is (unsoundly) accepted by
// AST-borrowck, but is correctly rejected by the NLL borrowck.
//
//[zflag] run-pass
//[edition] run-pass
-fn main() {
- match Some(&4) {
- None => {},
- ref mut foo
- if {
- (|| { let bar = foo; bar.take() })();
- false
- } => {},
- Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),
- _ => println!("Here is some supposedly unreachable code."),
- }
+pub struct Block<'a> {
+ current: &'a u8,
+ unrelated: &'a u8,
}
+
+fn bump<'a>(mut block: &mut Block<'a>) {
+ let x = &mut block;
+ let p: &'a u8 = &*block.current;
+ // (use `x` and `p` so enabling NLL doesn't assign overly short lifetimes)
+ drop(x);
+ drop(p);
+}
+
+fn main() {}
-warning[E0507]: cannot move out of `foo` in pattern guard
- --> $DIR/borrowck-migrate-to-nll.rs:26:18
+warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-migrate-to-nll.rs:28:21
|
-LL | (|| { let bar = foo; bar.take() })();
- | ^^ ---
- | | |
- | | move occurs because `foo` has type `&mut std::option::Option<&i32>`, which does not implement the `Copy` trait
- | | move occurs due to use in closure
- | move out of `foo` occurs here
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p: &'a u8 = &*block.current;
+ | ^^^^^^^^^^^^^^^ immutable borrow occurs here
+LL | // (use `x` and `p` so enabling NLL doesn't assign overly short lifetimes)
+LL | drop(x);
+ | - mutable borrow later used here
|
- = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
= 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
= note: for more information, try `rustc --explain E0729`
+++ /dev/null
-error[E0302]: cannot assign in a pattern guard
- --> $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:15:38
- |
-LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
- | ^ borrowed mutably in pattern guard
- |
- = 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:15:41
- |
-LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
- | ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
-
-error[E0510]: cannot assign `x` in match guard
- --> $DIR/borrowck-mutate-in-guard.rs:10:25
- |
-LL | match x {
- | - value is immutable in match guard
-LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
- | ^^^^^^^^^^^^^^^^^^ cannot assign
-
-error[E0510]: cannot mutably borrow `x` in match guard
- --> $DIR/borrowck-mutate-in-guard.rs:15:33
- |
-LL | match x {
- | - value is immutable in match guard
-...
-LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
- | ^^^^^^ cannot mutably borrow
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0301, E0302, E0510.
-For more information about an error, try `rustc --explain E0301`.
match x {
Enum::A(_) if { x = Enum::B(false); false } => 1,
//~^ ERROR cannot assign in a pattern guard
- //~| WARN cannot assign `x` in match guard
- //~| WARN this error has been downgraded to a warning for backwards compatibility
- //~| WARN this represents potential undefined behavior in your code and this warning will
+ //~| ERROR cannot assign `x` in match guard
Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
//~^ ERROR cannot mutably borrow in a pattern guard
//~| ERROR cannot assign in a pattern guard
- //~| WARN cannot mutably borrow `x` in match guard
- //~| WARN this error has been downgraded to a warning for backwards compatibility
- //~| WARN this represents potential undefined behavior in your code and this warning will
+ //~| ERROR cannot mutably borrow `x` in match guard
Enum::A(p) => *p,
Enum::B(_) => 2,
}
| ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
error[E0301]: cannot mutably borrow in a pattern guard
- --> $DIR/borrowck-mutate-in-guard.rs:15:38
+ --> $DIR/borrowck-mutate-in-guard.rs:13:38
|
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
| ^ borrowed mutably in pattern guard
= 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:15:41
+ --> $DIR/borrowck-mutate-in-guard.rs:13:41
|
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
| ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
-warning[E0510]: cannot assign `x` in match guard
+error[E0510]: cannot assign `x` in match guard
--> $DIR/borrowck-mutate-in-guard.rs:10:25
|
LL | match x {
| - value is immutable in match guard
LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
| ^^^^^^^^^^^^^^^^^^ cannot assign
- |
- = 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
- = note: for more information, try `rustc --explain E0729`
-warning[E0510]: cannot mutably borrow `x` in match guard
- --> $DIR/borrowck-mutate-in-guard.rs:15:33
+error[E0510]: cannot mutably borrow `x` in match guard
+ --> $DIR/borrowck-mutate-in-guard.rs:13:33
|
LL | match x {
| - value is immutable in match guard
...
LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
| ^^^^^^ cannot mutably borrow
- |
- = 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
- = note: for more information, try `rustc --explain E0729`
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
Some errors have detailed explanations: E0301, E0302, E0510.
For more information about an error, try `rustc --explain E0301`.
--- /dev/null
+fn main() {
+ match Some(&4) {
+ None => {},
+ ref mut foo
+ if {
+ (|| { let bar = foo; bar.take() })();
+ //~^ ERROR cannot move out of `foo` in pattern guard
+ false
+ } => {},
+ Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),
+ _ => println!("Here is some supposedly unreachable code."),
+ }
+}
--- /dev/null
+error[E0507]: cannot move out of `foo` in pattern guard
+ --> $DIR/issue-27282-mutation-in-guard.rs:6:18
+ |
+LL | (|| { let bar = foo; bar.take() })();
+ | ^^ ---
+ | | |
+ | | move occurs because `foo` has type `&mut std::option::Option<&i32>`, which does not implement the `Copy` trait
+ | | move occurs due to use in closure
+ | move out of `foo` occurs here
+ |
+ = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
--- /dev/null
+fn main() {
+ let a = Some("...".to_owned());
+ let b = match a {
+ Some(_) if { drop(a); false } => None,
+ x => x, //~ ERROR use of moved value: `a`
+ };
+ println!("{:?}", b);
+}
--- /dev/null
+error[E0382]: use of moved value: `a`
+ --> $DIR/issue-31287-drop-in-guard.rs:5:9
+ |
+LL | let a = Some("...".to_owned());
+ | - move occurs because `a` has type `std::option::Option<std::string::String>`, which does not implement the `Copy` trait
+LL | let b = match a {
+LL | Some(_) if { drop(a); false } => None,
+ | - value moved here
+LL | x => x,
+ | ^ value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
// unconst and bad, will thus error in miri
const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR any use of this
-// unconst and fine
-const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 };
+// unconst and bad, will thus error in miri
+const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 }; //~ ERROR any use of this
// unconst and fine
const Y: usize = unsafe { 42usize as *const i32 as usize + 1 };
// unconst and bad, will thus error in miri
|
= note: `#[deny(const_err)]` on by default
+error: any use of this value will cause an error
+ --> $DIR/const_raw_ptr_ops.rs:8:27
+ |
+LL | const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 };
+ | --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
+ | |
+ | "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:12:28
|
LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 };
- | ---------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
+ | ---------------------------^^^^^^^^^^^^^^^^^^^^^^^^^-------
| |
- | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
+ | "pointer-to-integer cast" needs an rfc before being allowed inside constants
error: any use of this value will cause an error
--> $DIR/const_raw_ptr_ops.rs:16:26
| |
| a memory access tried to interpret some bytes as a pointer
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
fn main() {
[(); { &loop { break } as *const _ as usize } ];
//~^ ERROR casting pointers to integers in constants is unstable
- //~| ERROR it is undefined behavior to use this value
+ //~| ERROR evaluation of constant value failed
}
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
= 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-52442.rs:2:11
+error[E0080]: evaluation of constant value failed
+ --> $DIR/issue-52442.rs:2:13
|
LL | [(); { &loop { break } as *const _ as usize } ];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
- |
- = 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
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
error: aborting due to 2 previous errors
let _: [u8; 0] = [4; {
match &1 as *const i32 as usize {
//~^ ERROR casting pointers to integers in constants
- //~| NOTE for more information, see
//~| ERROR constant contains unimplemented expression type
- 0 => 42, //~ ERROR constant contains unimplemented expression type
- //~^ NOTE "pointer arithmetic or comparison" needs an rfc before being allowed
//~| ERROR evaluation of constant value failed
+ 0 => 42, //~ ERROR constant contains unimplemented expression type
n => n,
}
}];
| ^
error[E0080]: evaluation of constant value failed
- --> $DIR/match-test-ptr-null.rs:10:13
+ --> $DIR/match-test-ptr-null.rs:6:15
|
-LL | 0 => 42,
- | ^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
+LL | match &1 as *const i32 as usize {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
error: aborting due to 4 previous errors
LL | const SHL_U8: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) };
| ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 8 in unchecked_shl
+ | Overflowing shift by 8 in `unchecked_shl`
|
= note: `#[deny(const_err)]` on by default
LL | const SHL_U16: u16 = unsafe { intrinsics::unchecked_shl(5_u16, 16) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 16 in unchecked_shl
+ | Overflowing shift by 16 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:18:31
LL | const SHL_U32: u32 = unsafe { intrinsics::unchecked_shl(5_u32, 32) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 32 in unchecked_shl
+ | Overflowing shift by 32 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:20:31
LL | const SHL_U64: u64 = unsafe { intrinsics::unchecked_shl(5_u64, 64) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 64 in unchecked_shl
+ | Overflowing shift by 64 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:22:33
LL | const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) };
| --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 128 in unchecked_shl
+ | Overflowing shift by 128 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:27:29
LL | const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) };
| ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 8 in unchecked_shl
+ | Overflowing shift by 8 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:29:31
LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 16 in unchecked_shl
+ | Overflowing shift by 16 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:31:31
LL | const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 32 in unchecked_shl
+ | Overflowing shift by 32 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:33:31
LL | const SHL_I64: i64 = unsafe { intrinsics::unchecked_shl(5_i64, 64) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 64 in unchecked_shl
+ | Overflowing shift by 64 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:35:33
LL | const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) };
| --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 128 in unchecked_shl
+ | Overflowing shift by 128 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:40:33
LL | const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) };
| --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 255 in unchecked_shl
+ | Overflowing shift by 255 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:42:35
LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) };
| ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 65535 in unchecked_shl
+ | Overflowing shift by 65535 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:44:35
LL | const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) };
| ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 4294967295 in unchecked_shl
+ | Overflowing shift by 4294967295 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:46:35
LL | const SHL_I64_NEG: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -1) };
| ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 18446744073709551615 in unchecked_shl
+ | Overflowing shift by 18446744073709551615 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:48:37
LL | const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) };
| ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 340282366920938463463374607431768211455 in unchecked_shl
+ | Overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:54:40
LL | const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) };
| ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 250 in unchecked_shl
+ | Overflowing shift by 250 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:56:42
LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) };
| -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 65523 in unchecked_shl
+ | Overflowing shift by 65523 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:58:42
LL | const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) };
| -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 4294967271 in unchecked_shl
+ | Overflowing shift by 4294967271 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:60:42
LL | const SHL_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -30) };
| -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 18446744073709551586 in unchecked_shl
+ | Overflowing shift by 18446744073709551586 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:62:44
LL | const SHL_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -93) };
| -------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 340282366920938463463374607431768211363 in unchecked_shl
+ | Overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shl`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:69:29
LL | const SHR_U8: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) };
| ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 8 in unchecked_shr
+ | Overflowing shift by 8 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:71:31
LL | const SHR_U16: u16 = unsafe { intrinsics::unchecked_shr(5_u16, 16) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 16 in unchecked_shr
+ | Overflowing shift by 16 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:73:31
LL | const SHR_U32: u32 = unsafe { intrinsics::unchecked_shr(5_u32, 32) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 32 in unchecked_shr
+ | Overflowing shift by 32 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:75:31
LL | const SHR_U64: u64 = unsafe { intrinsics::unchecked_shr(5_u64, 64) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 64 in unchecked_shr
+ | Overflowing shift by 64 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:77:33
LL | const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) };
| --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 128 in unchecked_shr
+ | Overflowing shift by 128 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:82:29
LL | const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) };
| ----------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 8 in unchecked_shr
+ | Overflowing shift by 8 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:84:31
LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 16 in unchecked_shr
+ | Overflowing shift by 16 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:86:31
LL | const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 32 in unchecked_shr
+ | Overflowing shift by 32 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:88:31
LL | const SHR_I64: i64 = unsafe { intrinsics::unchecked_shr(5_i64, 64) };
| ------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 64 in unchecked_shr
+ | Overflowing shift by 64 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:90:33
LL | const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) };
| --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 128 in unchecked_shr
+ | Overflowing shift by 128 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:95:33
LL | const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) };
| --------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 255 in unchecked_shr
+ | Overflowing shift by 255 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:97:35
LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) };
| ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 65535 in unchecked_shr
+ | Overflowing shift by 65535 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:99:35
LL | const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) };
| ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 4294967295 in unchecked_shr
+ | Overflowing shift by 4294967295 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:101:35
LL | const SHR_I64_NEG: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -1) };
| ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 18446744073709551615 in unchecked_shr
+ | Overflowing shift by 18446744073709551615 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:103:37
LL | const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) };
| ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 340282366920938463463374607431768211455 in unchecked_shr
+ | Overflowing shift by 340282366920938463463374607431768211455 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:109:40
LL | const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) };
| ---------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 250 in unchecked_shr
+ | Overflowing shift by 250 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:111:42
LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) };
| -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 65523 in unchecked_shr
+ | Overflowing shift by 65523 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:113:42
LL | const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) };
| -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 4294967271 in unchecked_shr
+ | Overflowing shift by 4294967271 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:115:42
LL | const SHR_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -30) };
| -----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 18446744073709551586 in unchecked_shr
+ | Overflowing shift by 18446744073709551586 in `unchecked_shr`
error: any use of this value will cause an error
--> $DIR/const-int-unchecked.rs:117:44
LL | const SHR_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -93) };
| -------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| |
- | Overflowing shift by 340282366920938463463374607431768211363 in unchecked_shr
+ | Overflowing shift by 340282366920938463463374607431768211363 in `unchecked_shr`
error: aborting due to 40 previous errors
const BAR: *mut () = ((|| 3) as fn() -> i32) as *mut ();
pub const FOO: usize = unsafe { BAR as usize };
-//~^ ERROR it is undefined behavior to use this value
+//~^ ERROR any use of this value will cause an error
fn main() {}
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/issue-51559.rs:4:1
+error: any use of this value will cause an error
+ --> $DIR/issue-51559.rs:4:33
|
LL | pub const FOO: usize = unsafe { BAR as usize };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
+ | --------------------------------^^^^^^^^^^^^---
+ | |
+ | "pointer-to-integer cast" needs an rfc before being allowed inside constants
|
- = 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
+ = note: `#[deny(const_err)]` on by default
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0080`.
// reject it. But I want to make sure that we continue to reject it
// (under NLL) even when that conservaive check goes away.
-
#![feature(bind_by_move_pattern_guards)]
-#![feature(nll)]
fn main() {
let mut b = &mut true;
error[E0596]: cannot borrow `r` as mutable, as it is immutable for the pattern guard
- --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:16:25
+ --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:14:25
|
LL | ref mut r if { (|| { let bar = &mut *r; **bar = false; })();
| ^^ - mutable borrow occurs due to use of `r` in closure
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
+ //~^ ERROR evaluation of constant value failed
}
= note: for more information, see https://github.com/rust-lang/rust/issues/51910
= 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
+error[E0080]: evaluation of constant value failed
--> $DIR/issue-52023-array-size-pointer-cast.rs:2:17
|
LL | let _ = [0; (&0 as *const i32) as usize];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
- |
- = 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
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants
error: aborting due to 2 previous errors
error: `$p:pat` is followed by `(`, which is not allowed for `pat` fragments
- --> $DIR/macro-follow.rs:8:14
+ --> $DIR/macro-follow.rs:8:13
|
LL | ($p:pat ()) => {};
- | ^ not allowed after `pat` fragments
+ | ^ not allowed after `pat` fragments
|
= note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in`
error: `$p:pat` is followed by `[`, which is not allowed for `pat` fragments
- --> $DIR/macro-follow.rs:9:14
+ --> $DIR/macro-follow.rs:9:13
|
LL | ($p:pat []) => {};
- | ^ not allowed after `pat` fragments
+ | ^ not allowed after `pat` fragments
|
= note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in`
error: `$p:pat` is followed by `{`, which is not allowed for `pat` fragments
- --> $DIR/macro-follow.rs:10:14
+ --> $DIR/macro-follow.rs:10:13
|
LL | ($p:pat {}) => {};
- | ^ not allowed after `pat` fragments
+ | ^ not allowed after `pat` fragments
|
= note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in`
= note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in`
error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments
- --> $DIR/macro-follow.rs:28:15
+ --> $DIR/macro-follow.rs:28:14
|
LL | ($e:expr ()) => {};
- | ^ not allowed after `expr` fragments
+ | ^ not allowed after `expr` fragments
|
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments
- --> $DIR/macro-follow.rs:29:15
+ --> $DIR/macro-follow.rs:29:14
|
LL | ($e:expr []) => {};
- | ^ not allowed after `expr` fragments
+ | ^ not allowed after `expr` fragments
|
= note: allowed there are: `=>`, `,` or `;`
error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments
- --> $DIR/macro-follow.rs:30:15
+ --> $DIR/macro-follow.rs:30:14
|
LL | ($e:expr {}) => {};
- | ^ not allowed after `expr` fragments
+ | ^ not allowed after `expr` fragments
|
= note: allowed there are: `=>`, `,` or `;`
= note: allowed there are: `=>`, `,` or `;`
error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments
- --> $DIR/macro-follow.rs:53:13
+ --> $DIR/macro-follow.rs:53:12
|
LL | ($t:ty ()) => {};
- | ^ not allowed after `ty` fragments
+ | ^ not allowed after `ty` fragments
|
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments
- --> $DIR/macro-follow.rs:71:15
+ --> $DIR/macro-follow.rs:71:14
|
LL | ($s:stmt ()) => {};
- | ^ not allowed after `stmt` fragments
+ | ^ not allowed after `stmt` fragments
|
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments
- --> $DIR/macro-follow.rs:72:15
+ --> $DIR/macro-follow.rs:72:14
|
LL | ($s:stmt []) => {};
- | ^ not allowed after `stmt` fragments
+ | ^ not allowed after `stmt` fragments
|
= note: allowed there are: `=>`, `,` or `;`
error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments
- --> $DIR/macro-follow.rs:73:15
+ --> $DIR/macro-follow.rs:73:14
|
LL | ($s:stmt {}) => {};
- | ^ not allowed after `stmt` fragments
+ | ^ not allowed after `stmt` fragments
|
= note: allowed there are: `=>`, `,` or `;`
= note: allowed there are: `=>`, `,` or `;`
error: `$p:path` is followed by `(`, which is not allowed for `path` fragments
- --> $DIR/macro-follow.rs:95:15
+ --> $DIR/macro-follow.rs:95:14
|
LL | ($p:path ()) => {};
- | ^ not allowed after `path` fragments
+ | ^ not allowed after `path` fragments
|
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
// run-pass
-#![feature(nll, bind_by_move_pattern_guards)]
+#![feature(bind_by_move_pattern_guards)]
// Test that z always point to the same temporary.
fn referent_stability() {
// Test that we have enough false edges to avoid exposing the exact matching
// algorithm in borrow checking.
-#![feature(nll, bind_by_move_pattern_guards)]
+#![feature(bind_by_move_pattern_guards)]
fn guard_always_precedes_arm(y: i32) {
let mut x;
};
}
-fn all_previous_tests_may_be_done(y: &mut (bool, bool)) {
- let r = &mut y.1;
- // We don't actually test y.1 to select the second arm, but we don't want
- // borrowck results to be based on the order we match patterns.
- match y {
- (false, true) => 1, //~ ERROR cannot use `y.1` because it was mutably borrowed
- (true, _) => {
- r;
- 2
- }
- (false, _) => 3,
- };
-}
-
fn main() {}
LL | x;
| ^ value used here after move
-error[E0503]: cannot use `y.1` because it was mutably borrowed
- --> $DIR/match-cfg-fake-edges.rs:49:17
- |
-LL | let r = &mut y.1;
- | -------- borrow of `y.1` occurs here
-...
-LL | (false, true) => 1,
- | ^^^^ use of borrowed `y.1`
-LL | (true, _) => {
-LL | r;
- | - borrow later used here
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0381, E0382, E0503.
+Some errors have detailed explanations: E0381, E0382.
For more information about an error, try `rustc --explain E0381`.
--- /dev/null
+// Test that we have enough false edges to avoid exposing the exact matching
+// algorithm in borrow checking.
+
+#![feature(nll)]
+
+fn all_previous_tests_may_be_done(y: &mut (bool, bool)) {
+ let r = &mut y.1;
+ // We don't actually test y.1 to select the second arm, but we don't want
+ // borrowck results to be based on the order we match patterns.
+ match y {
+ (false, true) => 1, //~ ERROR cannot use `y.1` because it was mutably borrowed
+ (true, _) => {
+ r;
+ 2
+ }
+ (false, _) => 3,
+ };
+}
+
+fn main() {}
--- /dev/null
+error[E0503]: cannot use `y.1` because it was mutably borrowed
+ --> $DIR/match-cfg-fake-edges2.rs:11:17
+ |
+LL | let r = &mut y.1;
+ | -------- borrow of `y.1` occurs here
+...
+LL | (false, true) => 1,
+ | ^^^^ use of borrowed `y.1`
+LL | (true, _) => {
+LL | r;
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
// Test that we don't allow mutating the value being matched on in a way that
// changes which patterns it matches, until we have chosen an arm.
-
#![feature(bind_by_move_pattern_guards)]
-#![feature(nll)]
fn ok_mutation_in_guard(mut q: i32) {
match q {
error[E0510]: cannot assign `q` in match guard
- --> $DIR/match-guards-partially-borrow.rs:59:13
+ --> $DIR/match-guards-partially-borrow.rs:57:13
|
LL | match q {
| - value is immutable in match guard
| ^^^^^^^^ cannot assign
error[E0510]: cannot assign `r` in match guard
- --> $DIR/match-guards-partially-borrow.rs:71:13
+ --> $DIR/match-guards-partially-borrow.rs:69:13
|
LL | match r {
| - value is immutable in match guard
| ^^^^^^^^ cannot assign
error[E0510]: cannot assign `t` in match guard
- --> $DIR/match-guards-partially-borrow.rs:95:13
+ --> $DIR/match-guards-partially-borrow.rs:93:13
|
LL | match t {
| - value is immutable in match guard
| ^^^^^^^^ cannot assign
error[E0510]: cannot mutably borrow `x.0` in match guard
- --> $DIR/match-guards-partially-borrow.rs:109:22
+ --> $DIR/match-guards-partially-borrow.rs:107:22
|
LL | match x {
| - value is immutable in match guard
| ^^^^^^^^^ cannot mutably borrow
error[E0506]: cannot assign to `t` because it is borrowed
- --> $DIR/match-guards-partially-borrow.rs:121:13
+ --> $DIR/match-guards-partially-borrow.rs:119:13
|
LL | s if {
| - borrow of `t` occurs here
| - borrow later used here
error[E0510]: cannot assign `y` in match guard
- --> $DIR/match-guards-partially-borrow.rs:132:13
+ --> $DIR/match-guards-partially-borrow.rs:130:13
|
LL | match *y {
| -- value is immutable in match guard
| ^^^^^^^^^ cannot assign
error[E0510]: cannot assign `z` in match guard
- --> $DIR/match-guards-partially-borrow.rs:143:13
+ --> $DIR/match-guards-partially-borrow.rs:141:13
|
LL | match z {
| - value is immutable in match guard
| ^^^^^^^^^ cannot assign
error[E0510]: cannot assign `a` in match guard
- --> $DIR/match-guards-partially-borrow.rs:155:13
+ --> $DIR/match-guards-partially-borrow.rs:153:13
|
LL | match a {
| - value is immutable in match guard
| ^^^^^^^^^ cannot assign
error[E0510]: cannot assign `b` in match guard
- --> $DIR/match-guards-partially-borrow.rs:166:13
+ --> $DIR/match-guards-partially-borrow.rs:164:13
|
LL | match b {
| - value is immutable in match guard
// rust-lang/rust#2329), that starts passing with this feature in
// place.
-// build-pass (FIXME(62277): could be check-pass?)
+// run-pass
#![feature(bind_by_move_pattern_guards)]
let (tx, rx) = channel();
let x = Some(rx);
tx.send(false);
+ tx.send(false);
match x {
Some(z) if z.recv().unwrap() => { panic!() },
Some(z) => { assert!(!z.recv().unwrap()); },
error: compilation successful
- --> $DIR/feature-gate.rs:41:1
+ --> $DIR/feature-gate.rs:36:1
|
LL | / fn main() {
LL | | foo(107)
error: compilation successful
- --> $DIR/feature-gate.rs:41:1
+ --> $DIR/feature-gate.rs:36:1
|
LL | / fn main() {
LL | | foo(107)
error[E0008]: cannot bind by-move into a pattern guard
- --> $DIR/feature-gate.rs:33:16
+ --> $DIR/feature-gate.rs:28:16
|
LL | A { a: v } if *v == 42 => v,
| ^ moves value into pattern guard
// gate-test-bind_by_move_pattern_guards
-// revisions: no_gate gate_and_2015 gate_and_2018 gate_and_znll gate_and_feature_nll
+// revisions: no_gate gate_and_2015 gate_and_2018
// (We're already testing NLL behavior quite explicitly, no need for compare-mode=nll.)
// ignore-compare-mode-nll
#![cfg_attr(gate_and_2015, feature(bind_by_move_pattern_guards))]
#![cfg_attr(gate_and_2018, feature(bind_by_move_pattern_guards))]
-#![cfg_attr(gate_and_znll, feature(bind_by_move_pattern_guards))]
-#![cfg_attr(gate_and_feature_nll, feature(bind_by_move_pattern_guards))]
-
-#![cfg_attr(gate_and_feature_nll, feature(nll))]
//[gate_and_2015] edition:2015
//[gate_and_2018] edition:2018
-//[gate_and_znll] compile-flags: -Z borrowck=mir
struct A { a: Box<i32> }
}
//[gate_and_2015]~^^^ ERROR compilation successful
//[gate_and_2018]~^^^^ ERROR compilation successful
-//[gate_and_znll]~^^^^^ ERROR compilation successful
-//[gate_and_feature_nll]~^^^^^^ ERROR compilation successful
#![feature(bind_by_move_pattern_guards)]
-// build-pass (FIXME(62277): could be check-pass?)
+// run-pass
struct A { a: Box<i32> }
fn get(&self) -> i32 { *self.a }
}
-fn foo(n: i32) {
+fn foo(n: i32) -> i32 {
let x = A { a: Box::new(n) };
let y = match x {
A { a: v } if *v == 42 => v,
_ => Box::new(0),
};
+ *y
}
-fn bar(n: i32) {
+fn bar(n: i32) -> i32 {
let x = A { a: Box::new(n) };
let y = match x {
A { a: v } if x.get() == 42 => v,
_ => Box::new(0),
};
+ *y
}
-fn baz(n: i32) {
+fn baz(n: i32) -> i32 {
let x = A { a: Box::new(n) };
let y = match x {
A { a: v } if *v.clone() == 42 => v,
_ => Box::new(0),
};
+ *y
}
fn main() {
- foo(107);
- bar(107);
- baz(107);
+ assert_eq!(foo(107), 0);
+ assert_eq!(foo(42), 42);
+ assert_eq!(bar(107), 0);
+ assert_eq!(bar(42), 42);
+ assert_eq!(baz(107), 0);
+ assert_eq!(baz(42), 42);
}
-#![feature(nll)]
#![feature(bind_by_move_pattern_guards)]
enum VecWrapper { A(Vec<i32>) }
error[E0507]: cannot move out of `v` in pattern guard
- --> $DIR/rfc-reject-double-move-across-arms.rs:8:36
+ --> $DIR/rfc-reject-double-move-across-arms.rs:7:36
|
LL | VecWrapper::A(v) if { drop(v); false } => 1,
| ^ move occurs because `v` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
-#![feature(nll)]
#![feature(bind_by_move_pattern_guards)]
struct A { a: Box<i32> }
error[E0507]: cannot move out of `v` in pattern guard
- --> $DIR/rfc-reject-double-move-in-first-arm.rs:9:30
+ --> $DIR/rfc-reject-double-move-in-first-arm.rs:8:30
|
LL | A { a: v } if { drop(v); true } => v,
| ^ move occurs because `v` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
--- /dev/null
+// check-pass
+
+// Regression test for the issue #63151:
+// Spurious unused field warning when matching variants under a `Self` scope
+//
+// This test checks that the `dead_code` lint properly inspects fields
+// in struct patterns that use a type relative path.
+
+#![deny(dead_code)]
+
+enum Enum {
+ Variant { field: usize }
+}
+
+impl Enum {
+ fn read_field(self) -> usize {
+ match self {
+ Self::Variant { field } => field
+ }
+ }
+}
+
+fn main() {
+ let e = Enum::Variant { field: 42 };
+ println!("{}", e.read_field());
+}
Test {
name: "servo",
repo: "https://github.com/servo/servo",
- sha: "987e376ca7a4245dbc3e0c06e963278ee1ac92d1",
+ sha: "caac107ae8145ef2fd20365e2b8fadaf09c2eb3b",
lock: None,
// Only test Stylo a.k.a. Quantum CSS, the parts of Servo going into Firefox.
// This takes much less time to build than all of Servo and supports stable Rust.
-Subproject commit 93d9538c6000fcf6c8da763ef4ce7a8d407b7d24
+Subproject commit 97cbb012155e5ee175974d9237a44700805fb22d
-Subproject commit 9e960e7d6a0c6b7c46c195acbd6f92ade6eec3ba
+Subproject commit 3adfb08afe3cb6a8c055e581dea87808464d1381