From da11610511c0486979a9605bc33043f6150ce9a0 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 8 Apr 2020 23:24:47 +0900 Subject: [PATCH 1/5] Rustup to the latest nightly --- src/bin/cargo_semver.rs | 5 +++-- src/mapping.rs | 2 +- src/traverse.rs | 13 +++++++------ tests/cases/addition/stdout | 2 ++ tests/cases/addition_path/stdout | 3 +++ tests/cases/addition_use/stdout | 2 +- tests/cases/bounds/stdout | 2 +- tests/cases/consts/stdout | 2 +- tests/cases/func/stdout | 2 +- tests/cases/inherent_impls/stdout | 2 +- tests/cases/macros/stdout | 2 +- tests/cases/mix/stdout | 2 +- tests/cases/pathologic_paths/stdout | 2 ++ tests/cases/sealed_traits/stdout | 2 ++ tests/cases/structs/stdout | 2 +- tests/cases/trait_impls/stdout | 2 +- tests/cases/traits/stdout | 2 +- tests/full_cases/libc-0.2.28-0.2.31.linux | 2 +- tests/full_cases/libc-0.2.28-0.2.31.osx | 2 +- tests/full_cases/log-0.3.4-0.3.8.linux | 6 ++++-- tests/full_cases/log-0.3.4-0.3.8.osx | 6 ++++-- tests/full_cases/log-0.3.4-0.3.8.windows_msvc | 2 ++ tests/full_cases/rmpv-0.4.0-0.4.1.linux | 2 +- tests/full_cases/rmpv-0.4.0-0.4.1.osx | 2 +- tests/full_cases/rmpv-0.4.0-0.4.1.windows_msvc | 2 +- 25 files changed, 45 insertions(+), 28 deletions(-) diff --git a/src/bin/cargo_semver.rs b/src/bin/cargo_semver.rs index 68793687..cd7bef75 100644 --- a/src/bin/cargo_semver.rs +++ b/src/bin/cargo_semver.rs @@ -3,9 +3,9 @@ #![allow(clippy::too_many_lines)] extern crate curl; -extern crate getopts; #[macro_use] extern crate serde; +extern crate rustc_session; extern crate serde_json; use cargo::core::{Package, PackageId, Source, SourceId, Workspace}; @@ -13,6 +13,7 @@ use cargo::sources::RegistrySource; use curl::easy::Easy; use log::debug; use rand::Rng; +use rustc_session::getopts; use std::collections::HashSet; use std::{ env, @@ -268,8 +269,8 @@ fn run(config: &cargo::Config, matches: &getopts::Matches) -> Result<()> { /// CLI utils mod cli { - extern crate getopts; use cargo::util::CliError; + use rustc_session::getopts; /// CLI options pub fn options() -> getopts::Options { diff --git a/src/mapping.rs b/src/mapping.rs index fa604d41..f0902245 100644 --- a/src/mapping.rs +++ b/src/mapping.rs @@ -49,7 +49,7 @@ impl Hash for InherentEntry { // FIXME derive Hash again once AssocKind derives Hash again. match self.kind { AssocKind::Const => 0u8.hash(hasher), - AssocKind::Method => 1u8.hash(hasher), + AssocKind::Fn => 1u8.hash(hasher), AssocKind::OpaqueTy => 2u8.hash(hasher), AssocKind::Type => 3u8.hash(hasher), } diff --git a/src/traverse.rs b/src/traverse.rs index 1d9b02e4..f501ca8d 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -377,10 +377,10 @@ fn diff_fn<'tcx>(changes: &mut ChangeSet, tcx: TyCtxt<'tcx>, old: Res, new: Res) /// Given two method items, perform structural checks. fn diff_method<'tcx>(changes: &mut ChangeSet, tcx: TyCtxt<'tcx>, old: AssocItem, new: AssocItem) { - if old.method_has_self_argument != new.method_has_self_argument { + if old.fn_has_self_parameter != new.fn_has_self_parameter { changes.add_change( ChangeType::MethodSelfChanged { - now_self: new.method_has_self_argument, + now_self: new.fn_has_self_parameter, }, old.def_id, None, @@ -628,8 +628,8 @@ fn diff_traits<'tcx>( (Some(old_item), Some(new_item)) => { let old_def_id = old_item.def_id; let new_def_id = new_item.def_id; - let old_res = Res::Def(old_item.def_kind(), old_def_id); - let new_res = Res::Def(new_item.def_kind(), new_def_id); + let old_res = Res::Def(old_item.kind.as_def_kind(), old_def_id); + let new_res = Res::Def(new_item.kind.as_def_kind(), new_def_id); id_mapping.add_trait_item(old_res, new_res, old); changes.new_change( @@ -1127,7 +1127,8 @@ fn is_impl_trait_public<'tcx>(tcx: TyCtxt<'tcx>, impl_def_id: DefId) -> bool { // Check if all input types of the trait implementation are public (including `Self`). let is_public = trait_ref - .input_types() + .substs + .types() .map(|t| type_visibility(tcx, t)) .all(|v| v == Visibility::Public); @@ -1275,7 +1276,7 @@ fn match_inherent_impl<'tcx>( infcx.tcx.type_of(orig_item_def_id), infcx.tcx.type_of(target_item_def_id), ), - (AssocKind::Method, AssocKind::Method) => { + (AssocKind::Fn, AssocKind::Fn) => { diff_method(changes, tcx, orig_item, target_item); let orig_sig = infcx.tcx.type_of(orig_item_def_id).fn_sig(tcx); let target_sig = infcx.tcx.type_of(target_item_def_id).fn_sig(tcx); diff --git a/tests/cases/addition/stdout b/tests/cases/addition/stdout index a560292d..3f8c0cbd 100644 --- a/tests/cases/addition/stdout +++ b/tests/cases/addition/stdout @@ -54,3 +54,5 @@ warning: path changes to `Cde` | = note: added definition (technically breaking) +warning: 6 warnings emitted + diff --git a/tests/cases/addition_path/stdout b/tests/cases/addition_path/stdout index b39c6cff..3ea7ba7f 100644 --- a/tests/cases/addition_path/stdout +++ b/tests/cases/addition_path/stdout @@ -30,3 +30,6 @@ warning: path changes to `d` | |_^ | = note: added definition (technically breaking) + +warning: 2 warnings emitted + diff --git a/tests/cases/addition_use/stdout b/tests/cases/addition_use/stdout index 71f064eb..b15dcadf 100644 --- a/tests/cases/addition_use/stdout +++ b/tests/cases/addition_use/stdout @@ -27,5 +27,5 @@ warning: path changes to `Bcd` | = note: added definition (technically breaking) -error: aborting due to previous error +error: aborting due to previous error; 2 warnings emitted diff --git a/tests/cases/bounds/stdout b/tests/cases/bounds/stdout index 5a2d4922..61cff1c0 100644 --- a/tests/cases/bounds/stdout +++ b/tests/cases/bounds/stdout @@ -35,5 +35,5 @@ warning: technically breaking changes in `def` | = note: removed bound: `A: std::clone::Clone` (technically breaking) -error: aborting due to 2 previous errors +error: aborting due to 2 previous errors; 2 warnings emitted diff --git a/tests/cases/consts/stdout b/tests/cases/consts/stdout index 891be6a0..36f2432a 100644 --- a/tests/cases/consts/stdout +++ b/tests/cases/consts/stdout @@ -31,5 +31,5 @@ warning: non-breaking changes in `E` | = note: static item made mutable (non-breaking) -error: aborting due to 3 previous errors +error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/cases/func/stdout b/tests/cases/func/stdout index 9c2d9c62..0cefacd6 100644 --- a/tests/cases/func/stdout +++ b/tests/cases/func/stdout @@ -75,5 +75,5 @@ error: breaking changes in `ijk` | = warning: fn item made non-const (breaking) -error: aborting due to 6 previous errors +error: aborting due to 6 previous errors; 2 warnings emitted diff --git a/tests/cases/inherent_impls/stdout b/tests/cases/inherent_impls/stdout index 7bf262d8..1756d63c 100644 --- a/tests/cases/inherent_impls/stdout +++ b/tests/cases/inherent_impls/stdout @@ -55,5 +55,5 @@ warning: technically breaking changes in `def` | = note: added item in inherent impl (technically breaking) -error: aborting due to 4 previous errors +error: aborting due to 4 previous errors; 2 warnings emitted diff --git a/tests/cases/macros/stdout b/tests/cases/macros/stdout index 41125728..d279b2dd 100644 --- a/tests/cases/macros/stdout +++ b/tests/cases/macros/stdout @@ -39,5 +39,5 @@ warning: path changes to `quux2` | = note: added definition (technically breaking) -error: aborting due to 2 previous errors +error: aborting due to 2 previous errors; 2 warnings emitted diff --git a/tests/cases/mix/stdout b/tests/cases/mix/stdout index 9d5774e5..3f3a942e 100644 --- a/tests/cases/mix/stdout +++ b/tests/cases/mix/stdout @@ -44,4 +44,4 @@ note: added path (technically breaking) 10 | pub use self::a::Def; | ^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/cases/pathologic_paths/stdout b/tests/cases/pathologic_paths/stdout index 9f8702d0..d9aae39f 100644 --- a/tests/cases/pathologic_paths/stdout +++ b/tests/cases/pathologic_paths/stdout @@ -15,3 +15,5 @@ warning: path changes to `b` | = note: added definition (technically breaking) +warning: 2 warnings emitted + diff --git a/tests/cases/sealed_traits/stdout b/tests/cases/sealed_traits/stdout index d0f32d42..4192b297 100644 --- a/tests/cases/sealed_traits/stdout +++ b/tests/cases/sealed_traits/stdout @@ -13,3 +13,5 @@ note: added item to sealed trait (technically breaking) 2 | fn abc(&self) -> bool; | ^^^^^^^^^^^^^^^^^^^^^^ +warning: 1 warning emitted + diff --git a/tests/cases/structs/stdout b/tests/cases/structs/stdout index 4f07a073..537021b3 100644 --- a/tests/cases/structs/stdout +++ b/tests/cases/structs/stdout @@ -79,5 +79,5 @@ warning: tuple struct with no public fields changed to a regular struct (breakin 28 | | } | |_^ -error: aborting due to 4 previous errors +error: aborting due to 4 previous errors; 2 warnings emitted diff --git a/tests/cases/trait_impls/stdout b/tests/cases/trait_impls/stdout index 976c04c9..d4ce24bb 100644 --- a/tests/cases/trait_impls/stdout +++ b/tests/cases/trait_impls/stdout @@ -51,5 +51,5 @@ warning: technically breaking changes in ` as new::Ab | = note: trait impl generalized or newly added (technically breaking) -error: aborting due to 2 previous errors +error: aborting due to 2 previous errors; 4 warnings emitted diff --git a/tests/cases/traits/stdout b/tests/cases/traits/stdout index ec29ba3c..864a1ac7 100644 --- a/tests/cases/traits/stdout +++ b/tests/cases/traits/stdout @@ -156,5 +156,5 @@ error: breaking changes in `Tuv` | = warning: removed bound on trait definition: `A: std::clone::Clone` (breaking) -error: aborting due to 13 previous errors +error: aborting due to 13 previous errors; 1 warning emitted diff --git a/tests/full_cases/libc-0.2.28-0.2.31.linux b/tests/full_cases/libc-0.2.28-0.2.31.linux index ff6b68d8..a79756a6 100644 --- a/tests/full_cases/libc-0.2.28-0.2.31.linux +++ b/tests/full_cases/libc-0.2.28-0.2.31.linux @@ -865,6 +865,6 @@ note: added path (technically breaking) 284 | pub use unix::*; | ^^^^^^^ -error: aborting due to 11 previous errors +error: aborting due to 11 previous errors; 63 warnings emitted error: rustc-semverver errored diff --git a/tests/full_cases/libc-0.2.28-0.2.31.osx b/tests/full_cases/libc-0.2.28-0.2.31.osx index 7cd9606a..eac71b88 100644 --- a/tests/full_cases/libc-0.2.28-0.2.31.osx +++ b/tests/full_cases/libc-0.2.28-0.2.31.osx @@ -2367,6 +2367,6 @@ note: added path (technically breaking) 284 | pub use unix::*; | ^^^^^^^ -error: aborting due to previous error +error: aborting due to previous error; 194 warnings emitted error: rustc-semverver errored diff --git a/tests/full_cases/log-0.3.4-0.3.8.linux b/tests/full_cases/log-0.3.4-0.3.8.linux index 19aebffb..e77b51cc 100644 --- a/tests/full_cases/log-0.3.4-0.3.8.linux +++ b/tests/full_cases/log-0.3.4-0.3.8.linux @@ -23,7 +23,7 @@ warning: technically breaking changes in ` as std::fmt::Debug | = note: trait impl generalized or newly added (technically breaking) -warning: technically breaking changes in ` as std::cmp::Eq>` +warning: technically breaking changes in ` as std::marker::StructuralEq>` --> log-0.3.8/src/lib.rs:552:10 | 552 | #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] @@ -71,7 +71,7 @@ warning: technically breaking changes in ` as std::fmt::Deb | = note: trait impl generalized or newly added (technically breaking) -warning: technically breaking changes in `` +warning: technically breaking changes in `` --> log-0.3.8/src/lib.rs:604:30 | 604 | #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -157,3 +157,5 @@ warning: path changes to `ShutdownLoggerError` | = note: added definition (technically breaking) +warning: 18 warnings emitted + diff --git a/tests/full_cases/log-0.3.4-0.3.8.osx b/tests/full_cases/log-0.3.4-0.3.8.osx index 19aebffb..e77b51cc 100644 --- a/tests/full_cases/log-0.3.4-0.3.8.osx +++ b/tests/full_cases/log-0.3.4-0.3.8.osx @@ -23,7 +23,7 @@ warning: technically breaking changes in ` as std::fmt::Debug | = note: trait impl generalized or newly added (technically breaking) -warning: technically breaking changes in ` as std::cmp::Eq>` +warning: technically breaking changes in ` as std::marker::StructuralEq>` --> log-0.3.8/src/lib.rs:552:10 | 552 | #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] @@ -71,7 +71,7 @@ warning: technically breaking changes in ` as std::fmt::Deb | = note: trait impl generalized or newly added (technically breaking) -warning: technically breaking changes in `` +warning: technically breaking changes in `` --> log-0.3.8/src/lib.rs:604:30 | 604 | #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -157,3 +157,5 @@ warning: path changes to `ShutdownLoggerError` | = note: added definition (technically breaking) +warning: 18 warnings emitted + diff --git a/tests/full_cases/log-0.3.4-0.3.8.windows_msvc b/tests/full_cases/log-0.3.4-0.3.8.windows_msvc index 449ca252..68ef6b55 100644 --- a/tests/full_cases/log-0.3.4-0.3.8.windows_msvc +++ b/tests/full_cases/log-0.3.4-0.3.8.windows_msvc @@ -157,3 +157,5 @@ warning: path changes to `ShutdownLoggerError` | = note: added definition (technically breaking) +warning: 18 warnings emitted + diff --git a/tests/full_cases/rmpv-0.4.0-0.4.1.linux b/tests/full_cases/rmpv-0.4.0-0.4.1.linux index 29a6aefd..92383e12 100644 --- a/tests/full_cases/rmpv-0.4.0-0.4.1.linux +++ b/tests/full_cases/rmpv-0.4.0-0.4.1.linux @@ -106,6 +106,6 @@ warning: technically breaking changes in ` Date: Sun, 19 Apr 2020 15:18:29 +0900 Subject: [PATCH 2/5] Fix/suppress clippy warnings --- src/mapping.rs | 8 ++++---- src/mismatch.rs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mapping.rs b/src/mapping.rs index f0902245..11a2ba37 100644 --- a/src/mapping.rs +++ b/src/mapping.rs @@ -48,10 +48,10 @@ impl Hash for InherentEntry { // FIXME derive Hash again once AssocKind derives Hash again. match self.kind { - AssocKind::Const => 0u8.hash(hasher), - AssocKind::Fn => 1u8.hash(hasher), - AssocKind::OpaqueTy => 2u8.hash(hasher), - AssocKind::Type => 3u8.hash(hasher), + AssocKind::Const => 0_u8.hash(hasher), + AssocKind::Fn => 1_u8.hash(hasher), + AssocKind::OpaqueTy => 2_u8.hash(hasher), + AssocKind::Type => 3_u8.hash(hasher), } self.name.hash(hasher); diff --git a/src/mismatch.rs b/src/mismatch.rs index 523dbf5e..10e71b08 100644 --- a/src/mismatch.rs +++ b/src/mismatch.rs @@ -129,6 +129,8 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> { Relate::relate(self, a, b) } + // Allow this since that lint is too pedantic here. + #[allow(clippy::similar_names)] fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { use rustc_middle::ty::TyKind; From d9186edf42f06f707e7b6caa23bcc51b01a5aa01 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 19 Apr 2020 15:35:33 +0900 Subject: [PATCH 3/5] Update xcode version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 83263b6b..1e4ea880 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ matrix: env: RUST_BACKTRACE=full - name: "osx" os: osx - osx_image: xcode10 + osx_image: xcode11.3 env: RUST_BACKTRACE=full - name: "windows" os: windows From 550aae2a29df77b7b3317fe858a638b75c7172b0 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 19 Apr 2020 15:43:55 +0900 Subject: [PATCH 4/5] Add `x86_64-pc-windows-msvc` target on CI --- ci/run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/run.sh b/ci/run.sh index 711acf56..4d995b1f 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -20,6 +20,7 @@ case "${TRAVIS_OS_NAME}" in TEST_TARGET=x86_64-unknown-linux-gnu cargo test --verbose -- --nocapture ;; *"windows"*) + rustup target add x86_64-pc-windows-msvc TEST_TARGET=x86_64-pc-windows-msvc cargo test --verbose -- --nocapture ;; *"macos"*) From d8595e6eb63aeee79cb9404b258c3e898d669b24 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 19 Apr 2020 16:06:20 +0900 Subject: [PATCH 5/5] Suppress pedantic lints --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e4ea880..5807ad3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ matrix: - name: "clippy" script: | if rustup component add clippy-preview rustc-dev; then - cargo clippy --all -- -D clippy::pedantic + cargo clippy --all fi - name: "Shellcheck" script: