Revert "Add a constness field to ast::TraitRef"

This reverts commit fd4a6a1213.
This commit is contained in:
Dylan MacKenzie 2020-01-13 20:30:29 -08:00
parent eb60346cc9
commit 1a3bd5775f
3 changed files with 5 additions and 20 deletions

View File

@ -110,7 +110,7 @@ impl<'a> ExtCtxt<'a> {
}
pub fn trait_ref(&self, path: ast::Path) -> ast::TraitRef {
ast::TraitRef { path, constness: None, ref_id: ast::DUMMY_NODE_ID }
ast::TraitRef { path, ref_id: ast::DUMMY_NODE_ID }
}
pub fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef {

View File

@ -1040,7 +1040,7 @@ impl Expr {
pub fn to_bound(&self) -> Option<GenericBound> {
match &self.kind {
ExprKind::Path(None, path) => Some(GenericBound::Trait(
PolyTraitRef::new(Vec::new(), path.clone(), None, self.span),
PolyTraitRef::new(Vec::new(), path.clone(), self.span),
TraitBoundModifier::None,
)),
_ => None,
@ -2383,15 +2383,6 @@ pub enum AttrKind {
pub struct TraitRef {
pub path: Path,
pub ref_id: NodeId,
/// The `const` modifier, if any, that appears before this trait.
///
/// | | `constness` |
/// |----------------|-----------------------------|
/// | `Trait` | `None` |
/// | `const Trait` | `Some(Constness::Const)` |
/// | `?const Trait` | `Some(Constness::NotConst)` |
pub constness: Option<Constness>,
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
@ -2406,15 +2397,10 @@ pub struct PolyTraitRef {
}
impl PolyTraitRef {
pub fn new(
generic_params: Vec<GenericParam>,
path: Path,
constness: Option<Constness>,
span: Span,
) -> Self {
pub fn new(generic_params: Vec<GenericParam>, path: Path, span: Span) -> Self {
PolyTraitRef {
bound_generic_params: generic_params,
trait_ref: TraitRef { path, constness, ref_id: DUMMY_NODE_ID },
trait_ref: TraitRef { path, ref_id: DUMMY_NODE_ID },
span,
}
}

View File

@ -838,8 +838,7 @@ pub fn noop_visit_variant_data<T: MutVisitor>(vdata: &mut VariantData, vis: &mut
}
}
pub fn noop_visit_trait_ref<T: MutVisitor>(tr: &mut TraitRef, vis: &mut T) {
let TraitRef { path, ref_id, constness: _ } = tr;
pub fn noop_visit_trait_ref<T: MutVisitor>(TraitRef { path, ref_id }: &mut TraitRef, vis: &mut T) {
vis.visit_path(path);
vis.visit_id(ref_id);
}