diff --git a/Cargo.lock b/Cargo.lock index 961a3ba9f19..cd50defbe6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -492,9 +492,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chalk-derive" -version = "0.55.0" +version = "0.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3983193cacd81f0f924acb666b7fe5e1a0d81db9f113fa69203eda7ea8ce8b6c" +checksum = "d54e3b5f9e3425e6b119ff07568d8d006bfa5a8d6f78a9cbc3530b1e962e316c" dependencies = [ "proc-macro2", "quote", @@ -504,9 +504,9 @@ dependencies = [ [[package]] name = "chalk-engine" -version = "0.55.0" +version = "0.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05a171ce5abbf0fbd06f221ab80ab182c7ef78603d23b858bc44e7ce8a86a396" +checksum = "bdc891073396b167163db77123b0a3c00088edc00466cecc5531f33e3e989523" dependencies = [ "chalk-derive", "chalk-ir", @@ -517,9 +517,9 @@ dependencies = [ [[package]] name = "chalk-ir" -version = "0.55.0" +version = "0.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a522f53af971e7678f472d687e053120157b3ae26e2ebd5ecbc0f5ab124f2cb6" +checksum = "2b79e5a1d04b79311e90c69356a2c62027853906a7e33b3e070b93c055fc3e8a" dependencies = [ "bitflags", "chalk-derive", @@ -528,14 +528,14 @@ dependencies = [ [[package]] name = "chalk-solve" -version = "0.55.0" +version = "0.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf79fb77a567e456a170f7ec84ea6584163d4ba3f13660cd182013d34ca667c" +checksum = "a5d2a1db6605aba70a58820bd80ac422b218913a510f1a40beef9efc5371ea1d" dependencies = [ "chalk-derive", "chalk-ir", "ena", - "itertools 0.9.0", + "itertools 0.10.1", "petgraph", "rustc-hash", "tracing", @@ -2107,9 +2107,9 @@ dependencies = [ [[package]] name = "matchers" -version = "0.0.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ "regex-automata", ] @@ -5122,9 +5122,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", @@ -5447,49 +5447,34 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" -version = "0.2.16" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ab8966ac3ca27126141f7999361cc97dd6fb4b71da04c02044fa9045d98bb96" +checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3" dependencies = [ "ansi_term 0.12.1", - "chrono", "lazy_static", "matchers", "parking_lot", "regex", - "serde", - "serde_json", "sharded-slab", "smallvec", "thread_local", "tracing", "tracing-core", "tracing-log", - "tracing-serde", ] [[package]] name = "tracing-tree" -version = "0.1.9" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1712b40907f8d9bc2bc66763ab61dec914b7123d7149e59feb0d4e2a95fc4967" +checksum = "3ce989c9962c7f61fe084dd4a230eec784649dfc2392467c790007c3a6e134e7" dependencies = [ "ansi_term 0.12.1", "atty", - "termcolor", - "tracing", + "tracing-core", "tracing-log", "tracing-subscriber", ] diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml index ce3a3f5a3a2..2383a000687 100644 --- a/compiler/rustc_driver/Cargo.toml +++ b/compiler/rustc_driver/Cargo.toml @@ -10,8 +10,8 @@ crate-type = ["dylib"] libc = "0.2" atty = "0.2" tracing = { version = "0.1.28" } -tracing-subscriber = { version = "0.2.16", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] } -tracing-tree = "0.1.9" +tracing-subscriber = { version = "0.3.3", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] } +tracing-tree = "0.2.0" rustc_middle = { path = "../rustc_middle" } rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_target = { path = "../rustc_target" } diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml index daeccde6024..a9db8469384 100644 --- a/compiler/rustc_middle/Cargo.toml +++ b/compiler/rustc_middle/Cargo.toml @@ -29,7 +29,7 @@ rustc_index = { path = "../rustc_index" } rustc_serialize = { path = "../rustc_serialize" } rustc_ast = { path = "../rustc_ast" } rustc_span = { path = "../rustc_span" } -chalk-ir = "0.55.0" +chalk-ir = "0.75.0" smallvec = { version = "1.6.1", features = ["union", "may_dangle"] } rustc_session = { path = "../rustc_session" } rustc_type_ir = { path = "../rustc_type_ir" } diff --git a/compiler/rustc_middle/src/traits/chalk.rs b/compiler/rustc_middle/src/traits/chalk.rs index 74873778f74..09a28249cce 100644 --- a/compiler/rustc_middle/src/traits/chalk.rs +++ b/compiler/rustc_middle/src/traits/chalk.rs @@ -206,35 +206,36 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> { Some(write!(fmt, "{:?}", opaque_ty.opaque_ty_id)) } - fn intern_ty(&self, ty: chalk_ir::TyData) -> Self::InternedType { - Box::new(ty) + fn intern_ty(self, ty: chalk_ir::TyKind) -> Self::InternedType { + let flags = ty.compute_flags(self); + Box::new(chalk_ir::TyData { kind: ty, flags: flags }) } - fn ty_data<'a>(&self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData { + fn ty_data<'a>(self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData { ty } - fn intern_lifetime(&self, lifetime: chalk_ir::LifetimeData) -> Self::InternedLifetime { + fn intern_lifetime(self, lifetime: chalk_ir::LifetimeData) -> Self::InternedLifetime { Box::new(lifetime) } fn lifetime_data<'a>( - &self, + self, lifetime: &'a Self::InternedLifetime, ) -> &'a chalk_ir::LifetimeData { &lifetime } - fn intern_const(&self, constant: chalk_ir::ConstData) -> Self::InternedConst { + fn intern_const(self, constant: chalk_ir::ConstData) -> Self::InternedConst { Box::new(constant) } - fn const_data<'a>(&self, constant: &'a Self::InternedConst) -> &'a chalk_ir::ConstData { + fn const_data<'a>(self, constant: &'a Self::InternedConst) -> &'a chalk_ir::ConstData { &constant } fn const_eq( - &self, + self, _ty: &Self::InternedType, c1: &Self::InternedConcreteConst, c2: &Self::InternedConcreteConst, @@ -242,143 +243,143 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> { c1 == c2 } - fn intern_generic_arg(&self, data: chalk_ir::GenericArgData) -> Self::InternedGenericArg { + fn intern_generic_arg(self, data: chalk_ir::GenericArgData) -> Self::InternedGenericArg { Box::new(data) } fn generic_arg_data<'a>( - &self, + self, data: &'a Self::InternedGenericArg, ) -> &'a chalk_ir::GenericArgData { &data } - fn intern_goal(&self, goal: chalk_ir::GoalData) -> Self::InternedGoal { + fn intern_goal(self, goal: chalk_ir::GoalData) -> Self::InternedGoal { Box::new(goal) } - fn goal_data<'a>(&self, goal: &'a Self::InternedGoal) -> &'a chalk_ir::GoalData { + fn goal_data<'a>(self, goal: &'a Self::InternedGoal) -> &'a chalk_ir::GoalData { &goal } fn intern_goals( - &self, + self, data: impl IntoIterator, E>>, ) -> Result { data.into_iter().collect::, _>>() } - fn goals_data<'a>(&self, goals: &'a Self::InternedGoals) -> &'a [chalk_ir::Goal] { + fn goals_data<'a>(self, goals: &'a Self::InternedGoals) -> &'a [chalk_ir::Goal] { goals } fn intern_substitution( - &self, + self, data: impl IntoIterator, E>>, ) -> Result { data.into_iter().collect::, _>>() } fn substitution_data<'a>( - &self, + self, substitution: &'a Self::InternedSubstitution, ) -> &'a [chalk_ir::GenericArg] { substitution } fn intern_program_clause( - &self, + self, data: chalk_ir::ProgramClauseData, ) -> Self::InternedProgramClause { Box::new(data) } fn program_clause_data<'a>( - &self, + self, clause: &'a Self::InternedProgramClause, ) -> &'a chalk_ir::ProgramClauseData { &clause } fn intern_program_clauses( - &self, + self, data: impl IntoIterator, E>>, ) -> Result { data.into_iter().collect::, _>>() } fn program_clauses_data<'a>( - &self, + self, clauses: &'a Self::InternedProgramClauses, ) -> &'a [chalk_ir::ProgramClause] { clauses } fn intern_quantified_where_clauses( - &self, + self, data: impl IntoIterator, E>>, ) -> Result { data.into_iter().collect::, _>>() } fn quantified_where_clauses_data<'a>( - &self, + self, clauses: &'a Self::InternedQuantifiedWhereClauses, ) -> &'a [chalk_ir::QuantifiedWhereClause] { clauses } fn intern_generic_arg_kinds( - &self, + self, data: impl IntoIterator, E>>, ) -> Result { data.into_iter().collect::, _>>() } fn variable_kinds_data<'a>( - &self, + self, parameter_kinds: &'a Self::InternedVariableKinds, ) -> &'a [chalk_ir::VariableKind] { parameter_kinds } fn intern_canonical_var_kinds( - &self, + self, data: impl IntoIterator, E>>, ) -> Result { data.into_iter().collect::, _>>() } fn canonical_var_kinds_data<'a>( - &self, + self, canonical_var_kinds: &'a Self::InternedCanonicalVarKinds, ) -> &'a [chalk_ir::CanonicalVarKind] { canonical_var_kinds } fn intern_constraints( - &self, + self, data: impl IntoIterator>, E>>, ) -> Result { data.into_iter().collect::, _>>() } fn constraints_data<'a>( - &self, + self, constraints: &'a Self::InternedConstraints, ) -> &'a [chalk_ir::InEnvironment>] { constraints } fn intern_variances( - &self, + self, data: impl IntoIterator>, ) -> Result { data.into_iter().collect::, _>>() } fn variances_data<'a>( - &self, + self, variances: &'a Self::InternedVariances, ) -> &'a [chalk_ir::Variance] { variances diff --git a/compiler/rustc_traits/Cargo.toml b/compiler/rustc_traits/Cargo.toml index 2e56a1bf683..f22751dc740 100644 --- a/compiler/rustc_traits/Cargo.toml +++ b/compiler/rustc_traits/Cargo.toml @@ -12,9 +12,9 @@ rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } rustc_ast = { path = "../rustc_ast" } rustc_span = { path = "../rustc_span" } -chalk-ir = "0.55.0" -chalk-solve = "0.55.0" -chalk-engine = "0.55.0" +chalk-ir = "0.75.0" +chalk-engine = "0.75.0" +chalk-solve = "0.75.0" smallvec = { version = "1.6.1", features = ["union", "may_dangle"] } rustc_infer = { path = "../rustc_infer" } rustc_trait_selection = { path = "../rustc_trait_selection" } diff --git a/compiler/rustc_traits/src/chalk/db.rs b/compiler/rustc_traits/src/chalk/db.rs index 1d457d6761f..1b79e537634 100644 --- a/compiler/rustc_traits/src/chalk/db.rs +++ b/compiler/rustc_traits/src/chalk/db.rs @@ -46,7 +46,9 @@ impl<'tcx> RustIrDatabase<'tcx> { .iter() .map(|(wc, _)| wc.subst(self.interner.tcx, bound_vars)) .map(|wc| wc.fold_with(&mut regions_substitutor)) - .filter_map(|wc| LowerInto::>>>::lower_into(wc, &self.interner)).collect() + .filter_map(|wc| LowerInto::< + Option>> + >::lower_into(wc, self.interner)).collect() } fn bounds_for(&self, def_id: DefId, bound_vars: SubstsRef<'tcx>) -> Vec @@ -58,14 +60,14 @@ impl<'tcx> RustIrDatabase<'tcx> { .explicit_item_bounds(def_id) .iter() .map(|(bound, _)| bound.subst(self.interner.tcx, &bound_vars)) - .filter_map(|bound| LowerInto::>::lower_into(bound, &self.interner)) + .filter_map(|bound| LowerInto::>::lower_into(bound, self.interner)) .collect() } } impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'tcx> { - fn interner(&self) -> &RustInterner<'tcx> { - &self.interner + fn interner(&self) -> RustInterner<'tcx> { + self.interner } fn associated_ty_data( @@ -83,7 +85,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t _ => unimplemented!("Not possible??"), } let bound_vars = bound_vars_for_item(self.interner.tcx, def_id); - let binders = binders_for(&self.interner, bound_vars); + let binders = binders_for(self.interner, bound_vars); let where_clauses = self.where_clauses_for(def_id, bound_vars); let bounds = self.bounds_for(def_id, bound_vars); @@ -107,7 +109,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t let trait_def = self.interner.tcx.trait_def(def_id); let bound_vars = bound_vars_for_item(self.interner.tcx, def_id); - let binders = binders_for(&self.interner, bound_vars); + let binders = binders_for(self.interner, bound_vars); let where_clauses = self.where_clauses_for(def_id, bound_vars); @@ -170,7 +172,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t let adt_def = adt_id.0; let bound_vars = bound_vars_for_item(self.interner.tcx, adt_def.did); - let binders = binders_for(&self.interner, bound_vars); + let binders = binders_for(self.interner, bound_vars); let where_clauses = self.where_clauses_for(adt_def.did, bound_vars); @@ -181,7 +183,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t fields: variant .fields .iter() - .map(|field| field.ty(self.interner.tcx, bound_vars).lower_into(&self.interner)) + .map(|field| field.ty(self.interner.tcx, bound_vars).lower_into(self.interner)) .collect(), }) .collect(); @@ -209,8 +211,8 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t adt_id: chalk_ir::AdtId>, ) -> Arc>> { let adt_def = adt_id.0; - let int = |i| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Int(i)).intern(&self.interner); - let uint = |i| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Uint(i)).intern(&self.interner); + let int = |i| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Int(i)).intern(self.interner); + let uint = |i| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Uint(i)).intern(self.interner); Arc::new(chalk_solve::rust_ir::AdtRepr { c: adt_def.repr.c(), packed: adt_def.repr.packed(), @@ -241,25 +243,25 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t ) -> Arc>> { let def_id = fn_def_id.0; let bound_vars = bound_vars_for_item(self.interner.tcx, def_id); - let binders = binders_for(&self.interner, bound_vars); + let binders = binders_for(self.interner, bound_vars); let where_clauses = self.where_clauses_for(def_id, bound_vars); let sig = self.interner.tcx.fn_sig(def_id); let (inputs_and_output, iobinders, _) = crate::chalk::lowering::collect_bound_vars( - &self.interner, + self.interner, self.interner.tcx, sig.inputs_and_output().subst(self.interner.tcx, bound_vars), ); let argument_types = inputs_and_output[..inputs_and_output.len() - 1] .iter() - .map(|t| t.subst(self.interner.tcx, &bound_vars).lower_into(&self.interner)) + .map(|t| t.subst(self.interner.tcx, &bound_vars).lower_into(self.interner)) .collect(); let return_type = inputs_and_output[inputs_and_output.len() - 1] .subst(self.interner.tcx, &bound_vars) - .lower_into(&self.interner); + .lower_into(self.interner); let bound = chalk_solve::rust_ir::FnDefDatumBound { inputs_and_output: chalk_ir::Binders::new( @@ -270,7 +272,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t }; Arc::new(chalk_solve::rust_ir::FnDefDatum { id: fn_def_id, - sig: sig.lower_into(&self.interner), + sig: sig.lower_into(self.interner), binders: chalk_ir::Binders::new(binders, bound), }) } @@ -281,7 +283,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t ) -> Arc>> { let def_id = impl_id.0; let bound_vars = bound_vars_for_item(self.interner.tcx, def_id); - let binders = binders_for(&self.interner, bound_vars); + let binders = binders_for(self.interner, bound_vars); let trait_ref = self.interner.tcx.impl_trait_ref(def_id).expect("not an impl"); let trait_ref = trait_ref.subst(self.interner.tcx, bound_vars); @@ -292,7 +294,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t let where_clauses = self.where_clauses_for(def_id, bound_vars); let value = chalk_solve::rust_ir::ImplDatumBound { - trait_ref: trait_ref.lower_into(&self.interner), + trait_ref: trait_ref.lower_into(self.interner), where_clauses, }; @@ -306,7 +308,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t .collect(); Arc::new(chalk_solve::rust_ir::ImplDatum { - polarity: self.interner.tcx.impl_polarity(def_id).lower_into(&self.interner), + polarity: self.interner.tcx.impl_polarity(def_id).lower_into(self.interner), binders: chalk_ir::Binders::new(binders, value), impl_type: chalk_solve::rust_ir::ImplType::Local, associated_ty_value_ids, @@ -336,10 +338,10 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t let mut regions_substitutor = lowering::RegionsSubstitutor::new(self.interner.tcx, self.reempty_placeholder); let self_ty = self_ty.fold_with(&mut regions_substitutor); - let lowered_ty = self_ty.lower_into(&self.interner); + let lowered_ty = self_ty.lower_into(self.interner); - parameters[0].assert_ty_ref(&self.interner).could_match( - &self.interner, + parameters[0].assert_ty_ref(self.interner).could_match( + self.interner, self.unification_database(), &lowered_ty, ) @@ -452,13 +454,13 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t .find_by_name_and_kind(self.interner.tcx, assoc_item.ident, assoc_item.kind, trait_id) .unwrap(); let bound_vars = bound_vars_for_item(self.interner.tcx, def_id); - let binders = binders_for(&self.interner, bound_vars); + let binders = binders_for(self.interner, bound_vars); let ty = self .interner .tcx .type_of(def_id) .subst(self.interner.tcx, bound_vars) - .lower_into(&self.interner); + .lower_into(self.interner); Arc::new(chalk_solve::rust_ir::AssociatedTyValue { impl_id: chalk_ir::ImplId(impl_id), @@ -521,13 +523,13 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t .filter_map(|bound| { LowerInto::< Option>> - >::lower_into(bound, &self.interner) + >::lower_into(bound, self.interner) }) .collect(); // Binder for the bound variable representing the concrete impl Trait type. let existential_binder = chalk_ir::VariableKinds::from1( - &self.interner, + self.interner, chalk_ir::VariableKind::Ty(chalk_ir::TyVariableKind::General), ); @@ -536,7 +538,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t where_clauses: chalk_ir::Binders::new(existential_binder, where_clauses), }; - let binders = binders_for(&self.interner, bound_vars); + let binders = binders_for(self.interner, bound_vars); Arc::new(chalk_solve::rust_ir::OpaqueTyDatum { opaque_ty_id, bound: chalk_ir::Binders::new(binders, value), @@ -568,6 +570,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t Unpin => lang_items.unpin_trait(), CoerceUnsized => lang_items.coerce_unsized_trait(), DiscriminantKind => lang_items.discriminant_kind_trait(), + Generator => lang_items.generator_return(), }; def_id.map(chalk_ir::TraitId) } @@ -584,7 +587,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t self.interner .tcx .mk_ty(ty::Tuple(self.interner.tcx.intern_substs(&[]))) - .lower_into(&self.interner) + .lower_into(self.interner) } fn closure_kind( @@ -592,8 +595,8 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t _closure_id: chalk_ir::ClosureId>, substs: &chalk_ir::Substitution>, ) -> chalk_solve::rust_ir::ClosureKind { - let kind = &substs.as_slice(&self.interner)[substs.len(&self.interner) - 3]; - match kind.assert_ty_ref(&self.interner).kind(&self.interner) { + let kind = &substs.as_slice(self.interner)[substs.len(self.interner) - 3]; + match kind.assert_ty_ref(self.interner).kind(self.interner) { chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Int(int_ty)) => match int_ty { chalk_ir::IntTy::I8 => chalk_solve::rust_ir::ClosureKind::Fn, chalk_ir::IntTy::I16 => chalk_solve::rust_ir::ClosureKind::FnMut, @@ -610,18 +613,17 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t substs: &chalk_ir::Substitution>, ) -> chalk_ir::Binders>> { - let sig = &substs.as_slice(&self.interner)[substs.len(&self.interner) - 2]; - match sig.assert_ty_ref(&self.interner).kind(&self.interner) { + let sig = &substs.as_slice(self.interner)[substs.len(self.interner) - 2]; + match sig.assert_ty_ref(self.interner).kind(self.interner) { chalk_ir::TyKind::Function(f) => { - let substitution = f.substitution.0.as_slice(&self.interner); - let return_type = - substitution.last().unwrap().assert_ty_ref(&self.interner).clone(); + let substitution = f.substitution.0.as_slice(self.interner); + let return_type = substitution.last().unwrap().assert_ty_ref(self.interner).clone(); // Closure arguments are tupled - let argument_tuple = substitution[0].assert_ty_ref(&self.interner); - let argument_types = match argument_tuple.kind(&self.interner) { + let argument_tuple = substitution[0].assert_ty_ref(self.interner); + let argument_types = match argument_tuple.kind(self.interner) { chalk_ir::TyKind::Tuple(_len, substitution) => substitution - .iter(&self.interner) - .map(|arg| arg.assert_ty_ref(&self.interner)) + .iter(self.interner) + .map(|arg| arg.assert_ty_ref(self.interner)) .cloned() .collect(), _ => bug!("Expecting closure FnSig args to be tupled."), @@ -629,7 +631,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t chalk_ir::Binders::new( chalk_ir::VariableKinds::from_iter( - &self.interner, + self.interner, (0..f.num_binders).map(|_| chalk_ir::VariableKind::Lifetime), ), chalk_solve::rust_ir::FnDefInputsAndOutputDatum { argument_types, return_type }, @@ -645,7 +647,7 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t substs: &chalk_ir::Substitution>, ) -> chalk_ir::Binders>> { let inputs_and_output = self.closure_inputs_and_output(_closure_id, substs); - let tuple = substs.as_slice(&self.interner).last().unwrap().assert_ty_ref(&self.interner); + let tuple = substs.as_slice(self.interner).last().unwrap().assert_ty_ref(self.interner); inputs_and_output.map_ref(|_| tuple.clone()) } @@ -654,8 +656,8 @@ impl<'tcx> chalk_solve::RustIrDatabase> for RustIrDatabase<'t _closure_id: chalk_ir::ClosureId>, substs: &chalk_ir::Substitution>, ) -> chalk_ir::Substitution> { - let substitution = &substs.as_slice(&self.interner)[0..substs.len(&self.interner) - 3]; - chalk_ir::Substitution::from_iter(&self.interner, substitution) + let substitution = &substs.as_slice(self.interner)[0..substs.len(self.interner) - 3]; + chalk_ir::Substitution::from_iter(self.interner, substitution) } fn generator_datum( @@ -691,7 +693,7 @@ impl<'tcx> chalk_ir::UnificationDatabase> for RustIrDatabase< ) -> chalk_ir::Variances> { let variances = self.interner.tcx.variances_of(def_id.0); chalk_ir::Variances::from_iter( - &self.interner, + self.interner, variances.iter().map(|v| match v { ty::Variance::Invariant => chalk_ir::Variance::Invariant, ty::Variance::Covariant => chalk_ir::Variance::Covariant, @@ -707,7 +709,7 @@ impl<'tcx> chalk_ir::UnificationDatabase> for RustIrDatabase< ) -> chalk_ir::Variances> { let variances = self.interner.tcx.variances_of(def_id.0.did); chalk_ir::Variances::from_iter( - &self.interner, + self.interner, variances.iter().map(|v| match v { ty::Variance::Invariant => chalk_ir::Variance::Invariant, ty::Variance::Covariant => chalk_ir::Variance::Covariant, @@ -752,7 +754,7 @@ fn bound_vars_for_item(tcx: TyCtxt<'tcx>, def_id: DefId) -> SubstsRef<'tcx> { } fn binders_for<'tcx>( - interner: &RustInterner<'tcx>, + interner: RustInterner<'tcx>, bound_vars: SubstsRef<'tcx>, ) -> chalk_ir::VariableKinds> { chalk_ir::VariableKinds::from_iter( diff --git a/compiler/rustc_traits/src/chalk/lowering.rs b/compiler/rustc_traits/src/chalk/lowering.rs index e24f699adf6..cc07bfc5008 100644 --- a/compiler/rustc_traits/src/chalk/lowering.rs +++ b/compiler/rustc_traits/src/chalk/lowering.rs @@ -46,26 +46,26 @@ use std::ops::ControlFlow; /// Essentially an `Into` with a `&RustInterner` parameter crate trait LowerInto<'tcx, T> { /// Lower a rustc construct (e.g., `ty::TraitPredicate`) to a chalk type, consuming `self`. - fn lower_into(self, interner: &RustInterner<'tcx>) -> T; + fn lower_into(self, interner: RustInterner<'tcx>) -> T; } impl<'tcx> LowerInto<'tcx, chalk_ir::Substitution>> for SubstsRef<'tcx> { fn lower_into( self, - interner: &RustInterner<'tcx>, + interner: RustInterner<'tcx>, ) -> chalk_ir::Substitution> { chalk_ir::Substitution::from_iter(interner, self.iter().map(|s| s.lower_into(interner))) } } impl<'tcx> LowerInto<'tcx, SubstsRef<'tcx>> for &chalk_ir::Substitution> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> SubstsRef<'tcx> { + fn lower_into(self, interner: RustInterner<'tcx>) -> SubstsRef<'tcx> { interner.tcx.mk_substs(self.iter(interner).map(|subst| subst.lower_into(interner))) } } impl<'tcx> LowerInto<'tcx, chalk_ir::AliasTy>> for ty::ProjectionTy<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::AliasTy> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::AliasTy> { chalk_ir::AliasTy::Projection(chalk_ir::ProjectionTy { associated_ty_id: chalk_ir::AssocTypeId(self.item_def_id), substitution: self.substs.lower_into(interner), @@ -78,7 +78,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::InEnvironment, + interner: RustInterner<'tcx>, ) -> chalk_ir::InEnvironment>> { let clauses = self.environment.into_iter().map(|predicate| { let (predicate, binders, _named_regions) = @@ -122,18 +122,18 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::InEnvironment> = self.goal.lower_into(&interner); + let goal: chalk_ir::GoalData> = self.goal.lower_into(interner); chalk_ir::InEnvironment { environment: chalk_ir::Environment { - clauses: chalk_ir::ProgramClauses::from_iter(&interner, clauses), + clauses: chalk_ir::ProgramClauses::from_iter(interner, clauses), }, - goal: goal.intern(&interner), + goal: goal.intern(interner), } } } impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData>> for ty::Predicate<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::GoalData> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::GoalData> { let (predicate, binders, _named_regions) = collect_bound_vars(interner, interner.tcx, self.kind()); @@ -214,7 +214,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData>> for ty::Predi impl<'tcx> LowerInto<'tcx, chalk_ir::TraitRef>> for rustc_middle::ty::TraitRef<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::TraitRef> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::TraitRef> { chalk_ir::TraitRef { trait_id: chalk_ir::TraitId(self.def_id), substitution: self.substs.lower_into(interner), @@ -225,7 +225,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::TraitRef>> impl<'tcx> LowerInto<'tcx, chalk_ir::AliasEq>> for rustc_middle::ty::ProjectionPredicate<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::AliasEq> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::AliasEq> { chalk_ir::AliasEq { ty: self.ty.lower_into(interner), alias: self.projection_ty.lower_into(interner), @@ -234,7 +234,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::AliasEq>> } impl<'tcx> LowerInto<'tcx, chalk_ir::Ty>> for Ty<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::Ty> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::Ty> { let int = |i| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Int(i)); let uint = |i| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Uint(i)); let float = |f| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Float(f)); @@ -336,7 +336,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty>> for Ty<'tcx> { } impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> Ty<'tcx> { + fn lower_into(self, interner: RustInterner<'tcx>) -> Ty<'tcx> { use chalk_ir::TyKind; let kind = match self.kind(interner) { @@ -429,7 +429,7 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty> { } impl<'tcx> LowerInto<'tcx, chalk_ir::Lifetime>> for Region<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::Lifetime> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::Lifetime> { use rustc_middle::ty::RegionKind::*; match self { @@ -459,7 +459,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Lifetime>> for Region<'t } impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> Region<'tcx> { + fn lower_into(self, interner: RustInterner<'tcx>) -> Region<'tcx> { let kind = match self.data(interner) { chalk_ir::LifetimeData::BoundVar(var) => ty::RegionKind::ReLateBound( ty::DebruijnIndex::from_u32(var.debruijn.depth()), @@ -487,7 +487,7 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime LowerInto<'tcx, chalk_ir::Const>> for ty::Const<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::Const> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::Const> { let ty = self.ty.lower_into(interner); let value = match self.val { ty::ConstKind::Value(val) => { @@ -503,7 +503,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Const>> for ty::Const<'t } impl<'tcx> LowerInto<'tcx, ty::Const<'tcx>> for &chalk_ir::Const> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> ty::Const<'tcx> { + fn lower_into(self, interner: RustInterner<'tcx>) -> ty::Const<'tcx> { let data = self.data(interner); let ty = data.ty.lower_into(interner); let val = match data.value { @@ -520,7 +520,7 @@ impl<'tcx> LowerInto<'tcx, ty::Const<'tcx>> for &chalk_ir::Const LowerInto<'tcx, chalk_ir::GenericArg>> for GenericArg<'tcx> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::GenericArg> { + fn lower_into(self, interner: RustInterner<'tcx>) -> chalk_ir::GenericArg> { match self.unpack() { ty::subst::GenericArgKind::Type(ty) => { chalk_ir::GenericArgData::Ty(ty.lower_into(interner)) @@ -539,7 +539,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GenericArg>> for Generic impl<'tcx> LowerInto<'tcx, ty::subst::GenericArg<'tcx>> for &chalk_ir::GenericArg> { - fn lower_into(self, interner: &RustInterner<'tcx>) -> ty::subst::GenericArg<'tcx> { + fn lower_into(self, interner: RustInterner<'tcx>) -> ty::subst::GenericArg<'tcx> { match self.data(interner) { chalk_ir::GenericArgData::Ty(ty) => { let t: Ty<'tcx> = ty.lower_into(interner); @@ -566,7 +566,7 @@ impl<'tcx> LowerInto<'tcx, Option, + interner: RustInterner<'tcx>, ) -> Option>> { let (predicate, binders, _named_regions) = collect_bound_vars(interner, interner.tcx, self.kind()); @@ -610,7 +610,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Binders, + interner: RustInterner<'tcx>, ) -> chalk_ir::Binders>> { // `Self` has one binder: // Binder<&'tcx ty::List>> @@ -680,7 +680,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Binders LowerInto<'tcx, chalk_ir::FnSig>> for ty::Binder<'tcx, ty::FnSig<'tcx>> { - fn lower_into(self, _interner: &RustInterner<'_>) -> FnSig> { + fn lower_into(self, _interner: RustInterner<'_>) -> FnSig> { chalk_ir::FnSig { abi: self.abi(), safety: match self.unsafety() { @@ -700,7 +700,7 @@ impl<'tcx> LowerInto<'tcx, Option, + interner: RustInterner<'tcx>, ) -> Option>> { let (predicate, binders, _named_regions) = collect_bound_vars(interner, interner.tcx, self.kind()); @@ -737,7 +737,7 @@ impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::TraitBound>> { fn lower_into( self, - interner: &RustInterner<'tcx>, + interner: RustInterner<'tcx>, ) -> chalk_solve::rust_ir::TraitBound> { chalk_solve::rust_ir::TraitBound { trait_id: chalk_ir::TraitId(self.def_id), @@ -747,7 +747,7 @@ impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::TraitBound>> } impl<'tcx> LowerInto<'tcx, chalk_ir::Mutability> for ast::Mutability { - fn lower_into(self, _interner: &RustInterner<'tcx>) -> chalk_ir::Mutability { + fn lower_into(self, _interner: RustInterner<'tcx>) -> chalk_ir::Mutability { match self { rustc_ast::Mutability::Mut => chalk_ir::Mutability::Mut, rustc_ast::Mutability::Not => chalk_ir::Mutability::Not, @@ -756,7 +756,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Mutability> for ast::Mutability { } impl<'tcx> LowerInto<'tcx, ast::Mutability> for chalk_ir::Mutability { - fn lower_into(self, _interner: &RustInterner<'tcx>) -> ast::Mutability { + fn lower_into(self, _interner: RustInterner<'tcx>) -> ast::Mutability { match self { chalk_ir::Mutability::Mut => ast::Mutability::Mut, chalk_ir::Mutability::Not => ast::Mutability::Not, @@ -765,7 +765,7 @@ impl<'tcx> LowerInto<'tcx, ast::Mutability> for chalk_ir::Mutability { } impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::Polarity> for ty::ImplPolarity { - fn lower_into(self, _interner: &RustInterner<'tcx>) -> chalk_solve::rust_ir::Polarity { + fn lower_into(self, _interner: RustInterner<'tcx>) -> chalk_solve::rust_ir::Polarity { match self { ty::ImplPolarity::Positive => chalk_solve::rust_ir::Polarity::Positive, ty::ImplPolarity::Negative => chalk_solve::rust_ir::Polarity::Negative, @@ -780,7 +780,7 @@ impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::AliasEqBound { fn lower_into( self, - interner: &RustInterner<'tcx>, + interner: RustInterner<'tcx>, ) -> chalk_solve::rust_ir::AliasEqBound> { let (trait_ref, own_substs) = self.projection_ty.trait_ref_and_own_substs(interner.tcx); chalk_solve::rust_ir::AliasEqBound { @@ -802,7 +802,7 @@ impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::AliasEqBound /// late-bound regions, even outside of fn contexts, since this is the best way /// to prep types for chalk lowering. crate fn collect_bound_vars<'tcx, T: TypeFoldable<'tcx>>( - interner: &RustInterner<'tcx>, + interner: RustInterner<'tcx>, tcx: TyCtxt<'tcx>, ty: Binder<'tcx, T>, ) -> (T, chalk_ir::VariableKinds>, BTreeMap) { diff --git a/compiler/rustc_traits/src/chalk/mod.rs b/compiler/rustc_traits/src/chalk/mod.rs index b7275bac190..a4d844e2eb8 100644 --- a/compiler/rustc_traits/src/chalk/mod.rs +++ b/compiler/rustc_traits/src/chalk/mod.rs @@ -63,7 +63,7 @@ crate fn evaluate_goal<'tcx>( > = chalk_ir::UCanonical { canonical: chalk_ir::Canonical { binders: chalk_ir::CanonicalVarKinds::from_iter( - &interner, + interner, obligation.variables.iter().map(|v| match v.kind { CanonicalVarKind::PlaceholderTy(_ty) => unimplemented!(), CanonicalVarKind::PlaceholderRegion(_ui) => unimplemented!(), @@ -89,7 +89,7 @@ crate fn evaluate_goal<'tcx>( CanonicalVarKind::PlaceholderConst(_pc) => unimplemented!(), }), ), - value: obligation.value.lower_into(&interner), + value: obligation.value.lower_into(interner), }, universes: max_universe + 1, }; @@ -110,11 +110,11 @@ crate fn evaluate_goal<'tcx>( use rustc_middle::infer::canonical::CanonicalVarInfo; let mut var_values: IndexVec> = IndexVec::new(); - subst.as_slice(&interner).iter().for_each(|p| { - var_values.push(p.lower_into(&interner)); + subst.as_slice(interner).iter().for_each(|p| { + var_values.push(p.lower_into(interner)); }); let variables: Vec<_> = binders - .iter(&interner) + .iter(interner) .map(|var| { let kind = match var.kind { chalk_ir::VariableKind::Ty(ty_kind) => CanonicalVarKind::Ty(match ty_kind { @@ -134,8 +134,7 @@ crate fn evaluate_goal<'tcx>( CanonicalVarInfo { kind } }) .collect(); - let max_universe = - binders.iter(&interner).map(|v| v.skip_kind().counter).max().unwrap_or(0); + let max_universe = binders.iter(interner).map(|v| v.skip_kind().counter).max().unwrap_or(0); let sol = Canonical { max_universe: ty::UniverseIndex::from_usize(max_universe), variables: tcx.intern_canonical_var_infos(&variables), diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 268905bcb53..3c9b6f5006d 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -19,11 +19,11 @@ itertools = "0.9" regex = "1" rustdoc-json-types = { path = "../rustdoc-json-types" } tracing = "0.1" -tracing-tree = "0.1.9" +tracing-tree = "0.2.0" tera = { version = "1.10.0", default-features = false } [dependencies.tracing-subscriber] -version = "0.2.13" +version = "0.3.3" default-features = false features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index e9426a2d9f5..23e49539969 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -9,7 +9,7 @@ diff = "0.1.10" unified-diff = "0.2.1" getopts = "0.2" tracing = "0.1" -tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] } +tracing-subscriber = { version = "0.3.3", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] } regex = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index d27afa497f6..edc6f52db3b 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -208,7 +208,6 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[ "tracing-attributes", "tracing-core", "tracing-log", - "tracing-serde", "tracing-subscriber", "tracing-tree", "typenum",