Skip to content

Commit

Permalink
Transition librustc_traits to 2018 edition
Browse files Browse the repository at this point in the history
  • Loading branch information
h-michael committed Feb 7, 2019
1 parent b139669 commit f03704b
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/librustc_traits/Cargo.toml
Expand Up @@ -2,6 +2,7 @@
authors = ["The Rust Project Developers"]
name = "rustc_traits"
version = "0.0.0"
edition = "2018"

[lib]
name = "rustc_traits"
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_traits/chalk_context/mod.rs
Expand Up @@ -502,13 +502,13 @@ type ChalkHhGoal<'tcx> = HhGoal<ChalkArenas<'tcx>>;
type ChalkExClause<'tcx> = ExClause<ChalkArenas<'tcx>>;

impl Debug for ChalkContext<'cx, 'gcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ChalkContext")
}
}

impl Debug for ChalkInferenceContext<'cx, 'gcx, 'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ChalkInferenceContext")
}
}
Expand Down Expand Up @@ -658,7 +658,7 @@ impl<'tcx, 'gcx: 'tcx, T> Upcast<'tcx, 'gcx> for Canonical<'gcx, T>
}
}

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
evaluate_goal,
..*p
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_traits/chalk_context/program_clauses.rs
Expand Up @@ -220,7 +220,7 @@ fn wf_clause_for_slice<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> {
def_id: sized_trait,
substs: tcx.mk_substs_trait(ty, ty::List::empty()),
};
let sized_implemented: DomainGoal = ty::TraitPredicate {
let sized_implemented: DomainGoal<'_> = ty::TraitPredicate {
trait_ref: sized_implemented
}.lower();

Expand Down Expand Up @@ -252,7 +252,7 @@ fn wf_clause_for_array<'tcx>(
def_id: sized_trait,
substs: tcx.mk_substs_trait(ty, ty::List::empty()),
};
let sized_implemented: DomainGoal = ty::TraitPredicate {
let sized_implemented: DomainGoal<'_> = ty::TraitPredicate {
trait_ref: sized_implemented
}.lower();

Expand Down Expand Up @@ -326,7 +326,7 @@ fn wf_clause_for_ref<'tcx>(
mutbl,
});

let _outlives: DomainGoal = ty::OutlivesPredicate(ty, region).lower();
let _outlives: DomainGoal<'_> = ty::OutlivesPredicate(ty, region).lower();
let wf_clause = ProgramClause {
goal: DomainGoal::WellFormed(WellFormed::Ty(ref_ty)),
hypotheses: ty::List::empty(),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_traits/dropck_outlives.rs
Expand Up @@ -10,7 +10,7 @@ use rustc::util::nodemap::FxHashSet;
use rustc_data_structures::sync::Lrc;
use syntax::source_map::{Span, DUMMY_SP};

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
dropck_outlives,
adt_dtorck_constraint,
Expand Down Expand Up @@ -305,7 +305,7 @@ crate fn adt_dtorck_constraint<'a, 'tcx>(
let mut result = def.all_fields()
.map(|field| tcx.type_of(field.did))
.map(|fty| dtorck_constraint_for_ty(tcx, span, fty, 0, fty))
.collect::<Result<DtorckConstraint, NoSolution>>()?;
.collect::<Result<DtorckConstraint<'_>, NoSolution>>()?;
result.outlives.extend(tcx.destructor_constraints(def));
dedup_dtorck_constraint(&mut result);

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_traits/evaluate_obligation.rs
Expand Up @@ -6,7 +6,7 @@ use rustc::ty::query::Providers;
use rustc::ty::{ParamEnvAnd, TyCtxt};
use syntax::source_map::DUMMY_SP;

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
evaluate_obligation,
..*p
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_traits/implied_outlives_bounds.rs
Expand Up @@ -17,7 +17,7 @@ use rustc::traits::FulfillmentContext;

use rustc_data_structures::sync::Lrc;

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
implied_outlives_bounds,
..*p
Expand Down
10 changes: 3 additions & 7 deletions src/librustc_traits/lib.rs
@@ -1,22 +1,18 @@
//! New recursive solver modeled on Chalk's recursive solver. Most of
//! the guts are broken up into modules; see the comments in those modules.

#![deny(rust_2018_idioms)]

#![feature(crate_visibility_modifier)]
#![feature(in_band_lifetimes)]
#![feature(nll)]

#![recursion_limit="256"]

extern crate chalk_engine;
#[macro_use]
extern crate log;
#[macro_use]
extern crate rustc;
extern crate rustc_data_structures;
extern crate rustc_target;
extern crate syntax;
extern crate syntax_pos;
extern crate smallvec;

mod chalk_context;
mod dropck_outlives;
Expand All @@ -30,7 +26,7 @@ mod type_op;

use rustc::ty::query::Providers;

pub fn provide(p: &mut Providers) {
pub fn provide(p: &mut Providers<'_>) {
dropck_outlives::provide(p);
evaluate_obligation::provide(p);
implied_outlives_bounds::provide(p);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_traits/lowering/mod.rs
Expand Up @@ -23,7 +23,7 @@ use syntax::ast;

use std::iter;

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
program_clauses_for,
program_clauses_for_env: environment::program_clauses_for_env,
Expand Down Expand Up @@ -193,7 +193,7 @@ fn program_clauses_for_trait<'a, 'tcx>(
};

// `Implemented(Self: Trait<P1..Pn>)`
let impl_trait: DomainGoal = trait_pred.lower();
let impl_trait: DomainGoal<'_> = trait_pred.lower();

// `FromEnv(Self: Trait<P1..Pn>)`
let from_env_goal = tcx.mk_goal(impl_trait.into_from_env_goal().into_goal());
Expand Down Expand Up @@ -575,7 +575,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
let ty = tcx.type_of(item_id);

// `Implemented(A0: Trait<A1..An>)`
let trait_implemented: DomainGoal = ty::TraitPredicate { trait_ref }.lower();
let trait_implemented: DomainGoal<'_> = ty::TraitPredicate { trait_ref }.lower();

// `<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm>`
let projection_ty = ty::ProjectionTy::from_ref_and_name(tcx, trait_ref, item.ident);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_traits/normalize_erasing_regions.rs
Expand Up @@ -4,7 +4,7 @@ use rustc::ty::query::Providers;
use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt};
use std::sync::atomic::Ordering;

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
normalize_ty_after_erasing_regions,
..*p
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_traits/normalize_projection_ty.rs
Expand Up @@ -8,7 +8,7 @@ use std::sync::atomic::Ordering;
use syntax::ast::DUMMY_NODE_ID;
use syntax_pos::DUMMY_SP;

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
normalize_projection_ty,
..*p
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_traits/type_op.rs
Expand Up @@ -21,7 +21,7 @@ use std::fmt;
use syntax::ast;
use syntax_pos::DUMMY_SP;

crate fn provide(p: &mut Providers) {
crate fn provide(p: &mut Providers<'_>) {
*p = Providers {
type_op_ascribe_user_type,
type_op_eq,
Expand Down

0 comments on commit f03704b

Please sign in to comment.