From f05dfe07f69cc126ee6c4132394b78d36e93c0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 13 Jul 2019 16:04:12 -0700 Subject: [PATCH 1/7] Cancel unemitted diagnostics during error recovery --- src/libsyntax/parse/parser.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 83030e89af310..e5c8c7f3a80e7 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -7410,13 +7410,12 @@ impl<'a> Parser<'a> { } else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) { let ident = self.parse_ident().unwrap(); self.bump(); // `(` - let kw_name = match self.parse_self_arg_with_attrs() { - Ok(Some(_)) => "method", - Ok(None) => "function", - Err(mut err) => { - err.cancel(); - "function" - } + let kw_name = if let Ok(Some(_)) = self.parse_self_arg_with_attrs() + .map_err(|mut e| e.cancel()) + { + "method" + } else { + "function" }; self.consume_block(token::Paren); let (kw, kw_name, ambiguous) = if self.check(&token::RArrow) { @@ -7464,7 +7463,9 @@ impl<'a> Parser<'a> { self.eat_to_tokens(&[&token::Gt]); self.bump(); // `>` let (kw, kw_name, ambiguous) = if self.eat(&token::OpenDelim(token::Paren)) { - if let Ok(Some(_)) = self.parse_self_arg_with_attrs() { + if let Ok(Some(_)) = self.parse_self_arg_with_attrs() + .map_err(|mut e| e.cancel()) + { ("fn", "method", false) } else { ("fn", "function", false) From d326d53d904b776e8992501b49dedb805b88b1ce Mon Sep 17 00:00:00 2001 From: Caio Date: Sun, 14 Jul 2019 22:03:19 -0300 Subject: [PATCH 2/7] Chapter for param_attrs --- .../src/language-features/param-attrs.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/param-attrs.md diff --git a/src/doc/unstable-book/src/language-features/param-attrs.md b/src/doc/unstable-book/src/language-features/param-attrs.md new file mode 100644 index 0000000000000..5e649487525b7 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/param-attrs.md @@ -0,0 +1,27 @@ +# `param_attrs` + +The tracking issue for this feature is: [#60406] + +[#60406]: https://github.com/rust-lang/rust/issues/60406 + +Allow attributes in formal function parameter position so external tools and compiler internals can +take advantage of the additional information that the parameters provide. + +Enables finer conditional compilation with `#[cfg(..)]` and linting control of variables. Moreover, +opens the path to richer DSLs created by users. + +------------------------ + +Example: + +```rust +#![feature(param_attrs)] + +fn len( + #[cfg(windows)] slice: &[u16], + #[cfg(not(windows))] slice: &[u8], +) -> usize +{ + slice.len() +} +``` \ No newline at end of file From 5ad4901bc99e9be9e7ab863886b7946c56e8ffbf Mon Sep 17 00:00:00 2001 From: Caio Date: Sun, 14 Jul 2019 22:28:42 -0300 Subject: [PATCH 3/7] Add newline --- src/doc/unstable-book/src/language-features/param-attrs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/unstable-book/src/language-features/param-attrs.md b/src/doc/unstable-book/src/language-features/param-attrs.md index 5e649487525b7..4b83c204ba105 100644 --- a/src/doc/unstable-book/src/language-features/param-attrs.md +++ b/src/doc/unstable-book/src/language-features/param-attrs.md @@ -24,4 +24,4 @@ fn len( { slice.len() } -``` \ No newline at end of file +``` From 3dd00bac7c60452055b657903da9c736149140ad Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 15 Jul 2019 09:18:32 -0700 Subject: [PATCH 4/7] ci: Remove Travis/AppVeyor configuration Now that we've fully moved to Azure Pipelines and bors has been updated to only gate on Azure this commit removes the remaining Travis/AppVeyor support contained in this repository. Most of the deletions here are related to producing better output on Travis by folding certain sections. This isn't supported by Azure so there's no need to keep it around, and if Azure ever adds support we can always add it back! --- .travis.yml | 10 ---- appveyor.yml | 9 --- src/bootstrap/check.rs | 5 -- src/bootstrap/compile.rs | 4 -- src/bootstrap/lib.rs | 15 +---- src/bootstrap/native.rs | 3 - src/bootstrap/test.rs | 15 ----- src/bootstrap/tool.rs | 2 - src/bootstrap/util.rs | 76 +------------------------- src/ci/docker/README.md | 2 +- src/ci/docker/run.sh | 9 --- src/ci/docker/x86_64-gnu-tools/repo.sh | 26 +-------- src/ci/init_repo.sh | 5 -- src/ci/run.sh | 18 ------ src/ci/shared.sh | 46 +--------------- 15 files changed, 11 insertions(+), 234 deletions(-) delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1d35ea0efacc2..0000000000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: shell -script: echo Travis CI is not used anymore - -branches: - only: - - auto - - try - -notifications: - email: false diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 003de85184c32..0000000000000 --- a/appveyor.yml +++ /dev/null @@ -1,9 +0,0 @@ -clone_depth: 1 -build: false - -test_script: - - echo AppVeyor is not used anymore - -branches: - only: - - auto diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index bdf5306d4b549..11b082ac3f6d8 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -50,7 +50,6 @@ impl Step for Std { let mut cargo = builder.cargo(compiler, Mode::Std, target, cargo_subcommand(builder.kind)); std_cargo(builder, &compiler, target, &mut cargo); - let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage)); builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, @@ -99,7 +98,6 @@ impl Step for Rustc { cargo_subcommand(builder.kind)); rustc_cargo(builder, &mut cargo); - let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage)); builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, @@ -153,7 +151,6 @@ impl Step for CodegenBackend { // We won't build LLVM if it's not available, as it shouldn't affect `check`. - let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); run_cargo(builder, &mut cargo, args(builder.kind), @@ -190,7 +187,6 @@ impl Step for Test { let mut cargo = builder.cargo(compiler, Mode::Test, target, cargo_subcommand(builder.kind)); test_cargo(builder, &compiler, target, &mut cargo); - let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage)); builder.info(&format!("Checking test artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, @@ -239,7 +235,6 @@ impl Step for Rustdoc { SourceType::InTree, &[]); - let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage)); println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target); run_cargo(builder, &mut cargo, diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 576267e6948f5..9ced04a5c808a 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -95,7 +95,6 @@ impl Step for Std { let mut cargo = builder.cargo(compiler, Mode::Std, target, "build"); std_cargo(builder, &compiler, target, &mut cargo); - let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage)); builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage, &compiler.host, target)); run_cargo(builder, @@ -422,7 +421,6 @@ impl Step for Test { let mut cargo = builder.cargo(compiler, Mode::Test, target, "build"); test_cargo(builder, &compiler, target, &mut cargo); - let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage)); builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage, &compiler.host, target)); run_cargo(builder, @@ -555,7 +553,6 @@ impl Step for Rustc { let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "build"); rustc_cargo(builder, &mut cargo); - let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage)); builder.info(&format!("Building stage{} compiler artifacts ({} -> {})", compiler.stage, &compiler.host, target)); run_cargo(builder, @@ -710,7 +707,6 @@ impl Step for CodegenBackend { let tmp_stamp = out_dir.join(".tmp.stamp"); - let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); let files = run_cargo(builder, cargo.arg("--features").arg(features), vec![], diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 4d297fa918a11..7011b7f1664c7 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -128,7 +128,7 @@ use build_helper::{ }; use filetime::FileTime; -use crate::util::{exe, libdir, OutputFolder, CiEnv}; +use crate::util::{exe, libdir, CiEnv}; mod cc_detect; mod channel; @@ -1092,19 +1092,6 @@ impl Build { } } - /// Fold the output of the commands after this method into a group. The fold - /// ends when the returned object is dropped. Folding can only be used in - /// the Travis CI environment. - pub fn fold_output(&self, name: F) -> Option - where D: Into, F: FnOnce() -> D - { - if !self.config.dry_run && self.ci_env == CiEnv::Travis { - Some(OutputFolder::new(name().into())) - } else { - None - } - } - /// Updates the actual toolstate of a tool. /// /// The toolstates are saved to the file specified by the key diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 8b6e856a8aba8..f8d1abe299473 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -104,7 +104,6 @@ impl Step for Llvm { } } - let _folder = builder.fold_output(|| "llvm"); let descriptor = if emscripten { "Emscripten " } else { "" }; builder.info(&format!("Building {}LLVM for {}", descriptor, target)); let _time = util::timeit(&builder); @@ -493,7 +492,6 @@ impl Step for Lld { return out_dir } - let _folder = builder.fold_output(|| "lld"); builder.info(&format!("Building LLD for {}", target)); let _time = util::timeit(&builder); t!(fs::create_dir_all(&out_dir)); @@ -560,7 +558,6 @@ impl Step for TestHelpers { return } - let _folder = builder.fold_output(|| "build_test_helpers"); builder.info("Building test helpers"); t!(fs::create_dir_all(&dst)); let mut cfg = cc::Build::new(); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 6c0c770bf0844..26fd7585ab5d1 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -713,7 +713,6 @@ impl Step for Tidy { cmd.arg("--verbose"); } - let _folder = builder.fold_output(|| "tidy"); builder.info("tidy check"); try_run(builder, &mut cmd); } @@ -1310,7 +1309,6 @@ impl Step for Compiletest { builder.ci_env.force_coloring_in_ci(&mut cmd); - let _folder = builder.fold_output(|| format!("test_{}", suite)); builder.info(&format!( "Check compiletest suite={} mode={} ({} -> {})", suite, mode, &compiler.host, target @@ -1320,7 +1318,6 @@ impl Step for Compiletest { if let Some(compare_mode) = compare_mode { cmd.arg("--compare-mode").arg(compare_mode); - let _folder = builder.fold_output(|| format!("test_{}_{}", suite, compare_mode)); builder.info(&format!( "Check compiletest suite={} mode={} compare_mode={} ({} -> {})", suite, mode, compare_mode, &compiler.host, target @@ -1364,7 +1361,6 @@ impl Step for DocTest { // tests for all files that end in `*.md` let mut stack = vec![builder.src.join(self.path)]; let _time = util::timeit(&builder); - let _folder = builder.fold_output(|| format!("test_{}", self.name)); let mut files = Vec::new(); while let Some(p) = stack.pop() { @@ -1495,7 +1491,6 @@ impl Step for ErrorIndex { .env("CFG_BUILD", &builder.config.build) .env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir()); - let _folder = builder.fold_output(|| "test_error_index"); builder.info(&format!("Testing error-index stage{}", compiler.stage)); let _time = util::timeit(&builder); builder.run(&mut tool); @@ -1819,14 +1814,6 @@ impl Step for Crate { ); } - let _folder = builder.fold_output(|| { - format!( - "{}_stage{}-{}", - test_kind.subcommand(), - compiler.stage, - krate - ) - }); builder.info(&format!( "{} {} stage{} ({} -> {})", test_kind, krate, compiler.stage, &compiler.host, target @@ -1894,8 +1881,6 @@ impl Step for CrateRustdoc { cargo.arg("--quiet"); } - let _folder = builder - .fold_output(|| format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage)); builder.info(&format!( "{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage, &compiler.host, target diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index a9269a7ad24ab..15a329a5b9152 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -74,7 +74,6 @@ impl Step for ToolBuild { &self.extra_features, ); - let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool)); builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target)); let mut duplicates = Vec::new(); let is_expected = compile::stream_cargo(builder, &mut cargo, vec![], &mut |msg| { @@ -509,7 +508,6 @@ impl Step for Rustdoc { &[], ); - let _folder = builder.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage)); builder.info(&format!("Building rustdoc for stage{} ({})", target_compiler.stage, target_compiler.host)); builder.run(&mut cargo); diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 47f5edd15631a..98ae7b692bb3c 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -6,10 +6,10 @@ use std::env; use std::str; use std::fs; -use std::io::{self, Write}; +use std::io; use std::path::{Path, PathBuf}; use std::process::Command; -use std::time::{SystemTime, Instant}; +use std::time::Instant; use build_helper::t; @@ -254,78 +254,12 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> { } } -/// An RAII structure that indicates all output until this instance is dropped -/// is part of the same group. -/// -/// On Travis CI, these output will be folded by default, together with the -/// elapsed time in this block. This reduces noise from unnecessary logs, -/// allowing developers to quickly identify the error. -/// -/// Travis CI supports folding by printing `travis_fold:start:` and -/// `travis_fold:end:` around the block. Time elapsed is recognized -/// similarly with `travis_time:[start|end]:`. These are undocumented, but -/// can easily be deduced from source code of the [Travis build commands]. -/// -/// [Travis build commands]: -/// https://github.com/travis-ci/travis-build/blob/f603c0089/lib/travis/build/templates/header.sh -pub struct OutputFolder { - name: String, - start_time: SystemTime, // we need SystemTime to get the UNIX timestamp. -} - -impl OutputFolder { - /// Creates a new output folder with the given group name. - pub fn new(name: String) -> OutputFolder { - // "\r" moves the cursor to the beginning of the line, and "\x1b[0K" is - // the ANSI escape code to clear from the cursor to end of line. - // Travis seems to have trouble when _not_ using "\r\x1b[0K", that will - // randomly put lines to the top of the webpage. - print!("travis_fold:start:{0}\r\x1b[0Ktravis_time:start:{0}\r\x1b[0K", name); - OutputFolder { - name, - start_time: SystemTime::now(), - } - } -} - -impl Drop for OutputFolder { - fn drop(&mut self) { - use std::time::*; - use std::u64; - - fn to_nanos(duration: Result) -> u64 { - match duration { - Ok(d) => d.as_secs() * 1_000_000_000 + d.subsec_nanos() as u64, - Err(_) => u64::MAX, - } - } - - let end_time = SystemTime::now(); - let duration = end_time.duration_since(self.start_time); - let start = self.start_time.duration_since(UNIX_EPOCH); - let finish = end_time.duration_since(UNIX_EPOCH); - println!( - "travis_fold:end:{0}\r\x1b[0K\n\ - travis_time:end:{0}:start={1},finish={2},duration={3}\r\x1b[0K", - self.name, - to_nanos(start), - to_nanos(finish), - to_nanos(duration) - ); - io::stdout().flush().unwrap(); - } -} - /// The CI environment rustbuild is running in. This mainly affects how the logs /// are printed. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum CiEnv { /// Not a CI environment. None, - /// The Travis CI environment, for Linux (including Docker) and macOS builds. - Travis, - /// The AppVeyor environment, for Windows builds. - AppVeyor, /// The Azure Pipelines environment, for Linux (including Docker), Windows, and macOS builds. AzurePipelines, } @@ -333,11 +267,7 @@ pub enum CiEnv { impl CiEnv { /// Obtains the current CI environment. pub fn current() -> CiEnv { - if env::var("TRAVIS").ok().map_or(false, |e| &*e == "true") { - CiEnv::Travis - } else if env::var("APPVEYOR").ok().map_or(false, |e| &*e == "True") { - CiEnv::AppVeyor - } else if env::var("TF_BUILD").ok().map_or(false, |e| &*e == "True") { + if env::var("TF_BUILD").ok().map_or(false, |e| &*e == "True") { CiEnv::AzurePipelines } else { CiEnv::None diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 34320ab4411e2..367e43849923f 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -20,7 +20,7 @@ Images will output artifacts in an `obj` dir at the root of a repository. - Each directory, excluding `scripts` and `disabled`, corresponds to a docker image - `scripts` contains files shared by docker images -- `disabled` contains images that are not built on travis +- `disabled` contains images that are not built on CI ## Docker Toolbox on Windows diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index e6cd794887c0a..dea41bee6e05c 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -17,9 +17,6 @@ dist=$objdir/build/dist source "$ci_dir/shared.sh" -travis_fold start build_docker -travis_time_start - if [ -f "$docker_dir/$image/Dockerfile" ]; then if [ "$CI" != "" ]; then hash_key=/tmp/.docker-hash-key.txt @@ -94,7 +91,6 @@ elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then echo Cannot run disabled images on CI! exit 1 fi - # retry messes with the pipe from tar to docker. Not needed on non-travis # Transform changes the context of disabled Dockerfiles to match the enabled ones tar --transform 's#^./disabled/#./#' -C $docker_dir -c . | docker \ build \ @@ -107,9 +103,6 @@ else exit 1 fi -travis_fold end build_docker -travis_time_finish - mkdir -p $HOME/.cargo mkdir -p $objdir/tmp mkdir -p $objdir/cores @@ -144,8 +137,6 @@ exec docker \ --env DEPLOY_ALT \ --env LOCAL_USER_ID=`id -u` \ --env CI \ - --env TRAVIS \ - --env TRAVIS_BRANCH \ --env TF_BUILD \ --env BUILD_SOURCEBRANCHNAME \ --env TOOLSTATE_REPO_ACCESS_TOKEN \ diff --git a/src/ci/docker/x86_64-gnu-tools/repo.sh b/src/ci/docker/x86_64-gnu-tools/repo.sh index 741d4dcbd9a45..56186a8b6a686 100644 --- a/src/ci/docker/x86_64-gnu-tools/repo.sh +++ b/src/ci/docker/x86_64-gnu-tools/repo.sh @@ -5,8 +5,7 @@ # # 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 `.travis.yml` and -# `appveyor.yml`: +# some reason you need to change the token, please update `.azure-pipelines/*`. # # 1. Generate a new Personal access token: # @@ -18,28 +17,9 @@ # Save it somewhere secure, as the token would be gone once you leave # the page. # -# 2. Encrypt the token for Travis CI +# 2. Update the variable group in Azure Pipelines # -# * Install the `travis` tool locally (`gem install travis`). -# * Encrypt the token: -# ``` -# travis -r rust-lang/rust encrypt \ -# TOOLSTATE_REPO_ACCESS_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -# ``` -# * Copy output to replace the existing one in `.travis.yml`. -# * Details of this step can be found in -# -# -# 3. Encrypt the token for AppVeyor -# -# * Login to AppVeyor using your main account, and login as the rust-lang -# organization. -# * Open the ["Encrypt data" tool](https://ci.appveyor.com/tools/encrypt) -# * Paste the 40-digit token into the "Value to encrypt" box, then click -# "Encrypt" -# * Copy the output to replace the existing one in `appveyor.yml`. -# * Details of this step can be found in -# +# * Ping a member of the infrastructure team to do this. # # 4. Replace the email address below if the bot account identity is changed # diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh index 8b635810825f1..c7c3b0a5fbf5b 100755 --- a/src/ci/init_repo.sh +++ b/src/ci/init_repo.sh @@ -11,9 +11,6 @@ set -o nounset ci_dir=$(cd $(dirname $0) && pwd) . "$ci_dir/shared.sh" -travis_fold start init_repo -travis_time_start - REPO_DIR="$1" CACHE_DIR="$2" @@ -73,5 +70,3 @@ retry sh -c "git submodule deinit -f $use_git && \ git submodule sync && \ git submodule update -j 16 --init --recursive $use_git" wait -travis_fold end init_repo -travis_time_finish diff --git a/src/ci/run.sh b/src/ci/run.sh index 811d401a83c21..b40bef7766573 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -91,27 +91,14 @@ if [ "$RUN_CHECK_WITH_PARALLEL_QUERIES" != "" ]; then rm -rf build fi -travis_fold start configure -travis_time_start $SRC/configure $RUST_CONFIGURE_ARGS -travis_fold end configure -travis_time_finish -travis_fold start make-prepare -travis_time_start retry make prepare -travis_fold end make-prepare -travis_time_finish -travis_fold start check-bootstrap -travis_time_start make check-bootstrap -travis_fold end check-bootstrap -travis_time_finish # Display the CPU and memory information. This helps us know why the CI timing # is fluctuating. -travis_fold start log-system-info if isOSX; then system_profiler SPHardwareDataType || true sysctl hw || true @@ -121,19 +108,14 @@ else cat /proc/meminfo || true ncpus=$(grep processor /proc/cpuinfo | wc -l) fi -travis_fold end log-system-info if [ ! -z "$SCRIPT" ]; then sh -x -c "$SCRIPT" else do_make() { - travis_fold start "make-$1" - travis_time_start echo "make -j $ncpus $1" make -j $ncpus $1 local retval=$? - travis_fold end "make-$1" - travis_time_finish return $retval } diff --git a/src/ci/shared.sh b/src/ci/shared.sh index 323d53f2bec85..b093a07ec5c5a 100644 --- a/src/ci/shared.sh +++ b/src/ci/shared.sh @@ -25,53 +25,13 @@ function retry { } function isCI { - [ "$CI" = "true" ] || [ "$TRAVIS" = "true" ] || [ "$TF_BUILD" = "True" ] + [ "$CI" = "true" ] || [ "$TF_BUILD" = "True" ] } function isOSX { - [ "$TRAVIS_OS_NAME" = "osx" ] || [ "$AGENT_OS" = "Darwin" ] + [ "$AGENT_OS" = "Darwin" ] } function getCIBranch { - if [ "$TRAVIS" = "true" ]; then - echo "$TRAVIS_BRANCH" - elif [ "$APPVEYOR" = "True" ]; then - echo "$APPVEYOR_REPO_BRANCH" - else - echo "$BUILD_SOURCEBRANCHNAME" - fi; + echo "$BUILD_SOURCEBRANCHNAME" } - -if ! declare -F travis_fold; then - if [ "${TRAVIS-false}" = 'true' ]; then - # This is a trimmed down copy of - # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh - travis_fold() { - echo -en "travis_fold:$1:$2\r\033[0K" - } - travis_time_start() { - travis_timer_id=$(printf %08x $(( RANDOM * RANDOM ))) - travis_start_time=$(travis_nanoseconds) - echo -en "travis_time:start:$travis_timer_id\r\033[0K" - } - travis_time_finish() { - travis_end_time=$(travis_nanoseconds) - local duration=$(($travis_end_time-$travis_start_time)) - local msg="travis_time:end:$travis_timer_id" - echo -en "\n$msg:start=$travis_start_time,finish=$travis_end_time,duration=$duration\r\033[0K" - } - if [ $(uname) = 'Darwin' ]; then - travis_nanoseconds() { - date -u '+%s000000000' - } - else - travis_nanoseconds() { - date -u '+%s%N' - } - fi - else - travis_fold() { return 0; } - travis_time_start() { return 0; } - travis_time_finish() { return 0; } - fi -fi From a36763af8a2015566c94a1c0ca6376a24a2355e6 Mon Sep 17 00:00:00 2001 From: Samy Kacimi Date: Mon, 15 Jul 2019 21:54:58 +0200 Subject: [PATCH 5/7] normalize use of backticks in compiler messages for libsyntax_ext https://github.com/rust-lang/rust/issues/60532 --- src/libsyntax_ext/deriving/clone.rs | 2 +- src/libsyntax_ext/test.rs | 6 +++--- src/test/ui/test-attr-non-associated-functions.rs | 2 +- src/test/ui/test-attr-non-associated-functions.stderr | 2 +- src/test/ui/test-on-macro.stderr | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs index b3b6328e2ca73..9a890a06e0396 100644 --- a/src/libsyntax_ext/deriving/clone.rs +++ b/src/libsyntax_ext/deriving/clone.rs @@ -73,7 +73,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt<'_>, } } - _ => cx.span_bug(span, "#[derive(Clone)] on trait item or impl item"), + _ => cx.span_bug(span, "`#[derive(Clone)]` on trait item or impl item"), } let inline = cx.meta_word(span, sym::inline); diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs index c5c5ef57b3122..4386fe8cfa2d6 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/libsyntax_ext/test.rs @@ -42,12 +42,12 @@ pub fn expand_test_or_bench( if let Annotatable::Item(i) = item { i } else { cx.parse_sess.span_diagnostic.span_fatal(item.span(), - "#[test] attribute is only allowed on non associated functions").raise(); + "`#[test]` attribute is only allowed on non associated functions").raise(); }; if let ast::ItemKind::Mac(_) = item.node { cx.parse_sess.span_diagnostic.span_warn(item.span, - "#[test] attribute should not be used on macros. Use #[cfg(test)] instead."); + "`#[test]` attribute should not be used on macros. Use `#[cfg(test)]` instead."); return vec![Annotatable::Item(item)]; } @@ -167,7 +167,7 @@ pub fn expand_test_or_bench( ast::ItemKind::ExternCrate(Some(sym::test)) ); - log::debug!("Synthetic test item:\n{}\n", pprust::item_to_string(&test_const)); + log::debug!("synthetic test item:\n{}\n", pprust::item_to_string(&test_const)); vec![ // Access to libtest under a gensymed name diff --git a/src/test/ui/test-attr-non-associated-functions.rs b/src/test/ui/test-attr-non-associated-functions.rs index 5ed85abaaa1b2..e475f5b4a75a5 100644 --- a/src/test/ui/test-attr-non-associated-functions.rs +++ b/src/test/ui/test-attr-non-associated-functions.rs @@ -6,7 +6,7 @@ struct A {} impl A { #[test] - fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions + fn new() -> A { //~ ERROR `#[test]` attribute is only allowed on non associated functions A {} } } diff --git a/src/test/ui/test-attr-non-associated-functions.stderr b/src/test/ui/test-attr-non-associated-functions.stderr index 6176aa03d84da..cb3ae51823e45 100644 --- a/src/test/ui/test-attr-non-associated-functions.stderr +++ b/src/test/ui/test-attr-non-associated-functions.stderr @@ -1,4 +1,4 @@ -error: #[test] attribute is only allowed on non associated functions +error: `#[test]` attribute is only allowed on non associated functions --> $DIR/test-attr-non-associated-functions.rs:9:5 | LL | / fn new() -> A { diff --git a/src/test/ui/test-on-macro.stderr b/src/test/ui/test-on-macro.stderr index 1af38829cc73e..256a41722fa95 100644 --- a/src/test/ui/test-on-macro.stderr +++ b/src/test/ui/test-on-macro.stderr @@ -1,4 +1,4 @@ -warning: #[test] attribute should not be used on macros. Use #[cfg(test)] instead. +warning: `#[test]` attribute should not be used on macros. Use `#[cfg(test)]` instead. --> $DIR/test-on-macro.rs:11:1 | LL | foo!(); From 7ddafaf6f95370935be339af71974da34752f1b5 Mon Sep 17 00:00:00 2001 From: Samy Kacimi Date: Mon, 15 Jul 2019 23:23:39 +0200 Subject: [PATCH 6/7] normalize use of backticks in compiler messages for libsyntax/parse https://github.com/rust-lang/rust/issues/60532 --- src/libsyntax/parse/attr.rs | 2 +- src/libsyntax/parse/diagnostics.rs | 2 +- src/libsyntax/parse/lexer/mod.rs | 2 +- src/test/ui/issues/issue-22644.stderr | 2 +- src/test/ui/issues/issue-34255-1.stderr | 2 +- src/test/ui/lifetime_starts_expressions.stderr | 2 +- src/test/ui/parser/recover-from-bad-variant.stderr | 2 +- .../ui/type/type-ascription-instead-of-statement-end.stderr | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index b28d48b9445fd..1758d0b0bb947 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -226,7 +226,7 @@ impl<'a> Parser<'a> { fn parse_unsuffixed_lit(&mut self) -> PResult<'a, ast::Lit> { let lit = self.parse_lit()?; - debug!("Checking if {:?} is unusuffixed.", lit); + debug!("checking if {:?} is unusuffixed", lit); if !lit.node.is_unsuffixed() { let msg = "suffixed literals are not allowed in attributes"; diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index 676c87f9daa3d..0e88a0ee28937 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -919,7 +919,7 @@ impl<'a> Parser<'a> { Applicability::MaybeIncorrect, ); } else { - err.note("#![feature(type_ascription)] lets you annotate an \ + err.note("`#![feature(type_ascription)]` lets you annotate an \ expression with a type: `: `") .span_note( lhs_span, diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index d0c4e8d6a5634..7be8e57c7f87f 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -443,7 +443,7 @@ impl<'a> StringReader<'a> { let is_beginning_of_file = self.pos == self.source_file.start_pos; if is_beginning_of_file { - debug!("Skipping a shebang"); + debug!("skipping a shebang"); let start = self.pos; while !self.ch_is('\n') && !self.is_eof() { self.bump(); diff --git a/src/test/ui/issues/issue-22644.stderr b/src/test/ui/issues/issue-22644.stderr index cf36953546549..4f0dc0a488765 100644 --- a/src/test/ui/issues/issue-22644.stderr +++ b/src/test/ui/issues/issue-22644.stderr @@ -89,7 +89,7 @@ error: expected type, found `4` LL | println!("{}", a: &mut 4); | ^ expecting a type here because of type ascription | - = note: #![feature(type_ascription)] lets you annotate an expression with a type: `: ` + = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` note: this expression expects an ascribed type after the colon --> $DIR/issue-22644.rs:34:20 | diff --git a/src/test/ui/issues/issue-34255-1.stderr b/src/test/ui/issues/issue-34255-1.stderr index 01f3953777017..0218a7abeaa4c 100644 --- a/src/test/ui/issues/issue-34255-1.stderr +++ b/src/test/ui/issues/issue-34255-1.stderr @@ -4,7 +4,7 @@ error: expected type, found `42` LL | Test::Drill(field: 42); | ^^ expecting a type here because of type ascription | - = note: #![feature(type_ascription)] lets you annotate an expression with a type: `: ` + = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` note: this expression expects an ascribed type after the colon --> $DIR/issue-34255-1.rs:8:17 | diff --git a/src/test/ui/lifetime_starts_expressions.stderr b/src/test/ui/lifetime_starts_expressions.stderr index 8ae8018c2ff25..84e4c87ebc4da 100644 --- a/src/test/ui/lifetime_starts_expressions.stderr +++ b/src/test/ui/lifetime_starts_expressions.stderr @@ -14,7 +14,7 @@ error: expected type, found keyword `loop` LL | loop { break 'label: loop { break 'label 42; }; } | ^^^^ expecting a type here because of type ascription | - = note: #![feature(type_ascription)] lets you annotate an expression with a type: `: ` + = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` note: this expression expects an ascribed type after the colon --> $DIR/lifetime_starts_expressions.rs:6:12 | diff --git a/src/test/ui/parser/recover-from-bad-variant.stderr b/src/test/ui/parser/recover-from-bad-variant.stderr index 150d74f07428d..d525bd3f4c6e5 100644 --- a/src/test/ui/parser/recover-from-bad-variant.stderr +++ b/src/test/ui/parser/recover-from-bad-variant.stderr @@ -4,7 +4,7 @@ error: expected type, found `3` LL | let x = Enum::Foo(a: 3, b: 4); | ^ expecting a type here because of type ascription | - = note: #![feature(type_ascription)] lets you annotate an expression with a type: `: ` + = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` note: this expression expects an ascribed type after the colon --> $DIR/recover-from-bad-variant.rs:7:23 | diff --git a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr index 4929922c83fe6..1f8989db81412 100644 --- a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr @@ -12,7 +12,7 @@ error: expected type, found `0` LL | println!("test"): 0; | ^ expecting a type here because of type ascription | - = note: #![feature(type_ascription)] lets you annotate an expression with a type: `: ` + = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` note: this expression expects an ascribed type after the colon --> $DIR/type-ascription-instead-of-statement-end.rs:9:5 | From 7df9ad3d0778a805169e08b03289603f9601e528 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 16 Jul 2019 08:25:01 -0700 Subject: [PATCH 7/7] ci: Bump time limit of tools builder on PRs This should give it enough time to finish instead of being killed after an hour. --- .azure-pipelines/pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/pr.yml b/.azure-pipelines/pr.yml index e77d047fa2d99..b389dcfef45a1 100644 --- a/.azure-pipelines/pr.yml +++ b/.azure-pipelines/pr.yml @@ -21,6 +21,7 @@ jobs: IMAGE: mingw-check - job: LinuxTools + timeoutInMinutes: 600 pool: vmImage: ubuntu-16.04 steps: