Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 054088a

Browse files
JohnTitoribabushkin
authored andcommitted
Rustup to latest nightly
1 parent 0286d2b commit 054088a

File tree

27 files changed

+211
-182
lines changed

27 files changed

+211
-182
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ matrix:
2828
fi
2929
- name: "clippy"
3030
script: |
31-
if rustup component add clippy-preview; then
31+
if rustup component add clippy-preview rustc-dev; then
3232
cargo clippy --all -- -D clippy::pedantic
3333
fi
3434
- name: "Shellcheck"

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ name = "rust-semver-public"
2727
path = "src/bin/rust_semver_public.rs"
2828

2929
[dependencies]
30-
cargo = "0.39"
31-
crates-io = "0.27"
30+
cargo = "0.42"
31+
crates-io = "0.30"
3232
curl = "0.4.21"
3333
env_logger = "0.7"
3434
failure = "0.1"
3535
log = "0.4"
3636
rand = "0.7"
3737
semver = "0.9"
38-
serde = "1.0.84"
39-
serde_derive = "1.0.84"
38+
serde = { version = "1.0.84", features = ["derive"] }
4039
serde_json = "1.0.34"
4140

4241
[dev-dependencies]

src/bin/cargo_semver.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
extern crate curl;
66
extern crate getopts;
7-
extern crate serde;
87
#[macro_use]
9-
extern crate serde_derive;
8+
extern crate serde;
109
extern crate serde_json;
1110

1211
use cargo::core::{Package, PackageId, Source, SourceId, Workspace};
@@ -483,7 +482,11 @@ impl<'a> WorkInfo<'a> {
483482
opts.build_config.build_plan = true;
484483

485484
if let Some(target) = matches.opt_str("target") {
486-
opts.build_config.requested_target = Some(target);
485+
let target = cargo::core::compiler::CompileTarget::new(&target);
486+
if let Ok(target) = target {
487+
let kind = cargo::core::compiler::CompileKind::Target(target);
488+
opts.build_config.requested_kind = kind;
489+
}
487490
}
488491

489492
if let Some(s) = matches.opt_str("features") {

src/bin/rust_semver_public.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
#![feature(rustc_private)]
2-
#![feature(result_map_or_else)]
32

4-
extern crate rustc;
53
extern crate rustc_driver;
64
extern crate rustc_interface;
7-
extern crate syntax;
5+
extern crate rustc_middle;
6+
extern crate rustc_span;
87

98
use log::debug;
109
use rustc_driver::{Callbacks, Compilation};
11-
use rustc_interface::interface;
10+
use rustc_interface::{interface, Queries};
11+
use rustc_span::source_map::Pos;
1212
use semverver::run_traversal;
1313
use std::{
1414
path::Path,
1515
process::{exit, Command},
1616
};
17-
use syntax::source_map::Pos;
1817

1918
/// Display semverver version.
2019
fn show_version() {
@@ -36,10 +35,10 @@ fn main() {
3635
struct PubCallbacks;
3736

3837
impl Callbacks for PubCallbacks {
39-
fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation {
38+
fn after_analysis<'tcx>(&mut self, _compiler: &interface::Compiler, queries: &'tcx Queries<'tcx>) -> Compilation {
4039
debug!("running rust-semver-public after_analysis callback");
4140

42-
compiler.global_ctxt().unwrap().peek_mut().enter(|tcx| {
41+
queries.global_ctxt().unwrap().peek_mut().enter(|tcx| {
4342
let krate = tcx
4443
.crates()
4544
.iter()

src/bin/rust_semverver.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
#![feature(rustc_private)]
2-
#![feature(result_map_or_else)]
32

4-
extern crate rustc;
5-
extern crate rustc_codegen_utils;
63
extern crate rustc_driver;
74
extern crate rustc_errors;
85
extern crate rustc_interface;
96
extern crate rustc_metadata;
10-
extern crate syntax;
7+
extern crate rustc_middle;
8+
extern crate rustc_span;
119

1210
use log::debug;
1311
use rustc_driver::{Callbacks, Compilation};
14-
use rustc_interface::interface;
12+
use rustc_interface::{interface, Queries};
13+
use rustc_span::source_map::Pos;
1514
use semverver::run_analysis;
1615
use std::{
1716
path::Path,
1817
process::{exit, Command},
1918
};
20-
use syntax::source_map::Pos;
2119

2220
/// Display semverver version.
2321
fn show_version() {
@@ -38,7 +36,7 @@ fn main() {
3836
struct SemverCallbacks;
3937

4038
impl Callbacks for SemverCallbacks {
41-
fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation {
39+
fn after_analysis<'tcx>(&mut self, _compiler: &interface::Compiler, queries: &'tcx Queries<'tcx>) -> Compilation {
4240
debug!("running rust-semverver after_analysis callback");
4341

4442
let verbose =
@@ -55,7 +53,7 @@ fn main() {
5553
"no_version".to_owned()
5654
};
5755

58-
compiler.global_ctxt().unwrap().peek_mut().enter(|tcx| {
56+
queries.global_ctxt().unwrap().peek_mut().enter(|tcx| {
5957
// To select the old and new crates we look at the position of the
6058
// declaration in the source file. The first one will be the `old`
6159
// and the other will be `new`. This is unfortunately a bit hacky...

src/changes.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@
99
//! complicated by the fact that we still group changes by the item they refer to, even if it's
1010
//! path changes.
1111
12-
use rustc::{
13-
hir::def_id::DefId,
14-
session::Session,
15-
ty::{error::TypeError, Predicate},
16-
};
12+
use rustc_hir::def_id::DefId;
13+
use rustc_middle::ty::{error::TypeError, Predicate};
14+
use rustc_session::Session;
15+
use rustc_span::symbol::Symbol;
16+
use rustc_span::{FileName, Span};
1717
use semver::Version;
1818
use std::{
1919
cmp::Ordering,
2020
collections::{BTreeMap, BTreeSet, HashMap},
2121
fmt,
2222
};
23-
use syntax::symbol::Symbol;
24-
use syntax_pos::{FileName, Span};
2523

2624
use serde::ser::{SerializeSeq, SerializeStruct, Serializer};
2725
use serde::Serialize;
@@ -306,11 +304,19 @@ pub enum ChangeType<'tcx> {
306304
/// A possibly public field has been added to a variant or struct.
307305
///
308306
/// This also records whether all fields are public were public before the change.
309-
VariantFieldAdded { public: bool, total_public: bool, is_enum: bool },
307+
VariantFieldAdded {
308+
public: bool,
309+
total_public: bool,
310+
is_enum: bool,
311+
},
310312
/// A possibly public field has been removed from a variant or struct.
311313
///
312314
/// This also records whether all fields were public before the change.
313-
VariantFieldRemoved { public: bool, total_public: bool, is_enum: bool },
315+
VariantFieldRemoved {
316+
public: bool,
317+
total_public: bool,
318+
is_enum: bool,
319+
},
314320
/// A variant or struct has changed it's style.
315321
///
316322
/// The style could have been changed from a tuple variant/struct to a regular
@@ -671,7 +677,7 @@ impl<'a> fmt::Display for ChangeType<'a> {
671677
VariantFieldRemoved {
672678
public: true,
673679
total_public: false,
674-
is_enum: true
680+
is_enum: true,
675681
} => "public field removed from variant with private fields",
676682
VariantFieldRemoved {
677683
public: true,
@@ -1219,13 +1225,13 @@ pub mod tests {
12191225
extern crate quickcheck;
12201226
use quickcheck::*;
12211227

1222-
use rustc::hir::def_id::DefId;
1228+
use rustc_hir::def_id::DefId;
12231229

12241230
use std::cmp::{max, min};
12251231

1226-
use syntax_pos::hygiene::SyntaxContext;
1227-
use syntax_pos::symbol::Interner;
1228-
use syntax_pos::BytePos;
1232+
use rustc_span::hygiene::SyntaxContext;
1233+
use rustc_span::symbol::Interner;
1234+
use rustc_span::BytePos;
12291235

12301236
/// A wrapper for `Span` that can be randomly generated.
12311237
#[derive(Clone, Debug)]
@@ -1257,7 +1263,7 @@ pub mod tests {
12571263

12581264
impl Arbitrary for DefId_ {
12591265
fn arbitrary<G: Gen>(g: &mut G) -> DefId_ {
1260-
use rustc::hir::def_id::{CrateNum, DefIndex};
1266+
use rustc_hir::def_id::{CrateNum, DefIndex};
12611267

12621268
let a: u32 = Arbitrary::arbitrary(g);
12631269
let b: u32 = Arbitrary::arbitrary(g);

src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
#![allow(clippy::single_match_else)]
44
#![allow(clippy::too_many_lines)]
55
#![deny(warnings)]
6-
extern crate rustc;
7-
extern crate syntax;
8-
extern crate syntax_pos;
6+
extern crate rustc_ast;
7+
extern crate rustc_hir;
8+
extern crate rustc_infer;
9+
extern crate rustc_middle;
10+
extern crate rustc_mir;
11+
extern crate rustc_session;
12+
extern crate rustc_span;
13+
extern crate rustc_trait_selection;
14+
extern crate rustc_traits;
915

1016
mod changes;
1117
mod mapping;

src/mapping.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
//! This module provides facilities to record item correspondence of various kinds, as well as a
44
//! map used to temporarily match up unsorted item sequences' elements by name.
55
6-
use rustc::{
7-
hir::{
8-
def::{Export, Res},
9-
def_id::{CrateNum, DefId},
10-
HirId,
11-
},
6+
use rustc_ast::ast::Name;
7+
use rustc_hir::{
8+
def::Res,
9+
def_id::{CrateNum, DefId},
10+
HirId,
11+
};
12+
use rustc_middle::{
13+
hir::exports::Export,
1214
ty::{AssocKind, GenericParamDef, GenericParamDefKind},
1315
};
1416
use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
1517
use std::hash::{Hash, Hasher};
16-
use syntax::ast::Name;
1718

1819
/// A description of an item found in an inherent impl.
1920
#[derive(Debug, PartialEq)]
@@ -40,6 +41,7 @@ fn assert_inherent_entry_members_impl_eq() {
4041
assert_impl_eq::<Name>();
4142
}
4243

44+
#[allow(clippy::derive_hash_xor_eq)]
4345
impl Hash for InherentEntry {
4446
fn hash<H: Hasher>(&self, hasher: &mut H) {
4547
self.parent_def_id.hash(hasher);
@@ -111,14 +113,19 @@ impl IdMapping {
111113

112114
/// Register two exports representing the same item across versions.
113115
pub fn add_export(&mut self, old: Res, new: Res) -> bool {
114-
let old_def_id = old.def_id();
116+
let (old_def_id, new_def_id) =
117+
if let (Some(old_def_id), Some(new_def_id)) = (old.opt_def_id(), new.opt_def_id()) {
118+
(old_def_id, new_def_id)
119+
} else {
120+
return false;
121+
};
115122

116123
if !self.in_old_crate(old_def_id) || self.toplevel_mapping.contains_key(&old_def_id) {
117124
return false;
118125
}
119126

120127
self.toplevel_mapping.insert(old_def_id, (old, new));
121-
self.reverse_mapping.insert(new.def_id(), old_def_id);
128+
self.reverse_mapping.insert(new_def_id, old_def_id);
122129

123130
true
124131
}
@@ -343,8 +350,8 @@ pub struct NameMapping {
343350
impl NameMapping {
344351
/// Insert a single export in the appropriate map, at the appropriate position.
345352
fn insert(&mut self, item: Export<HirId>, old: bool) {
346-
use rustc::hir::def::DefKind::*;
347-
use rustc::hir::def::Res::*;
353+
use rustc_hir::def::DefKind::*;
354+
use rustc_hir::def::Res::*;
348355

349356
let map = match item.res {
350357
Def(kind, _) => match kind {
@@ -366,7 +373,7 @@ impl NameMapping {
366373
ConstParam |
367374
Static |
368375
Ctor(_, _) |
369-
Method |
376+
AssocFn |
370377
AssocConst => Some(&mut self.value_map),
371378
Macro(_) => Some(&mut self.macro_map),
372379
},

src/mismatch.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
77
use crate::mapping::IdMapping;
88
use log::debug;
9-
use rustc::{
10-
hir::def::{DefKind, Res},
11-
ty::{
12-
self,
13-
relate::{Relate, RelateResult, TypeRelation},
14-
subst::SubstsRef,
15-
ParamEnv, Ty, TyCtxt,
16-
Visibility::Public,
17-
},
9+
use rustc_hir::def::{DefKind, Res};
10+
use rustc_middle::ty::{
11+
self,
12+
relate::{Relate, RelateResult, TypeRelation},
13+
subst::SubstsRef,
14+
ParamEnv, Ty, TyCtxt,
15+
Visibility::Public,
1816
};
1917
use std::collections::{HashMap, HashSet, VecDeque};
2018

@@ -51,7 +49,7 @@ impl<'a, 'tcx> MismatchRelation<'a, 'tcx> {
5149

5250
/// Process the next pair of `DefId`s in the queue.
5351
pub fn process(&mut self) {
54-
// use rustc::hir::def::DefKind::*;
52+
// use rustc_middle::hir::def::DefKind::*;
5553

5654
while let Some((old_res, new_res)) = self.item_queue.pop_front() {
5755
debug!(
@@ -87,7 +85,7 @@ impl<'a, 'tcx> MismatchRelation<'a, 'tcx> {
8785

8886
/// Ensure that the pair of given `SubstsRef`s is suitable to be related.
8987
fn check_substs(&self, a_substs: SubstsRef<'tcx>, b_substs: SubstsRef<'tcx>) -> bool {
90-
use rustc::ty::subst::GenericArgKind::*;
88+
use rustc_middle::ty::subst::GenericArgKind::*;
9189

9290
for (a, b) in a_substs.iter().zip(b_substs) {
9391
match (a.unpack(), b.unpack()) {
@@ -132,7 +130,7 @@ impl<'a, 'tcx> TypeRelation<'tcx> for MismatchRelation<'a, 'tcx> {
132130
}
133131

134132
fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
135-
use rustc::ty::TyKind;
133+
use rustc_middle::ty::TyKind;
136134

137135
if self.current_old_types.contains(a) || self.current_new_types.contains(b) {
138136
return Ok(self.tcx.types.err);

0 commit comments

Comments
 (0)