Skip to content

Commit f93183a

Browse files
leoyvenspetrochenkov
authored andcommitted
Remove impl Foo for .. in favor of auto trait Foo
No longer parse it. Remove AutoTrait variant from AST and HIR. Remove backwards compatibility lint. Remove coherence checks, they make no sense for the new syntax. Remove from rustdoc.
1 parent 9b2f8ac commit f93183a

File tree

54 files changed

+94
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+94
-447
lines changed

src/libcore/marker.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,10 @@ use hash::Hasher;
4040
/// [ub]: ../../reference/behavior-considered-undefined.html
4141
#[stable(feature = "rust1", since = "1.0.0")]
4242
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
43-
pub unsafe trait Send {
43+
pub unsafe auto trait Send {
4444
// empty.
4545
}
4646

47-
#[stable(feature = "rust1", since = "1.0.0")]
48-
#[allow(unknown_lints)]
49-
#[allow(auto_impl)]
50-
unsafe impl Send for .. { }
51-
5247
#[stable(feature = "rust1", since = "1.0.0")]
5348
impl<T: ?Sized> !Send for *const T { }
5449
#[stable(feature = "rust1", since = "1.0.0")]
@@ -345,15 +340,10 @@ pub trait Copy : Clone {
345340
#[stable(feature = "rust1", since = "1.0.0")]
346341
#[lang = "sync"]
347342
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
348-
pub unsafe trait Sync {
343+
pub unsafe auto trait Sync {
349344
// Empty
350345
}
351346

352-
#[stable(feature = "rust1", since = "1.0.0")]
353-
#[allow(unknown_lints)]
354-
#[allow(auto_impl)]
355-
unsafe impl Sync for .. { }
356-
357347
#[stable(feature = "rust1", since = "1.0.0")]
358348
impl<T: ?Sized> !Sync for *const T { }
359349
#[stable(feature = "rust1", since = "1.0.0")]
@@ -563,11 +553,7 @@ mod impls {
563553
/// This affects, for example, whether a `static` of that type is
564554
/// placed in read-only static memory or writable static memory.
565555
#[lang = "freeze"]
566-
unsafe trait Freeze {}
567-
568-
#[allow(unknown_lints)]
569-
#[allow(auto_impl)]
570-
unsafe impl Freeze for .. {}
556+
unsafe auto trait Freeze {}
571557

572558
impl<T: ?Sized> !Freeze for UnsafeCell<T> {}
573559
unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}

src/librustc/dep_graph/dep_node.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@ define_dep_nodes!( <'tcx>
496496
[] SuperPredicatesOfItem(DefId),
497497
[] TraitDefOfItem(DefId),
498498
[] AdtDefOfItem(DefId),
499-
[] IsAutoImpl(DefId),
500499
[] ImplTraitRef(DefId),
501500
[] ImplPolarity(DefId),
502501
[] FnSignature(DefId),

src/librustc/hir/intravisit.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,6 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
498498
// visit_enum_def() takes care of visiting the Item's NodeId
499499
visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span)
500500
}
501-
ItemAutoImpl(_, ref trait_ref) => {
502-
visitor.visit_id(item.id);
503-
visitor.visit_trait_ref(trait_ref)
504-
}
505501
ItemImpl(.., ref type_parameters, ref opt_trait_reference, ref typ, ref impl_item_refs) => {
506502
visitor.visit_id(item.id);
507503
visitor.visit_generics(type_parameters);

src/librustc/hir/lowering.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,16 +1952,6 @@ impl<'a> LoweringContext<'a> {
19521952
let vdata = self.lower_variant_data(vdata);
19531953
hir::ItemUnion(vdata, self.lower_generics(generics))
19541954
}
1955-
ItemKind::AutoImpl(unsafety, ref trait_ref) => {
1956-
let trait_ref = self.lower_trait_ref(trait_ref, ImplTraitContext::Disallowed);
1957-
1958-
if let Def::Trait(def_id) = trait_ref.path.def {
1959-
self.trait_auto_impl.insert(def_id, id);
1960-
}
1961-
1962-
hir::ItemAutoImpl(self.lower_unsafety(unsafety),
1963-
trait_ref)
1964-
}
19651955
ItemKind::Impl(unsafety,
19661956
polarity,
19671957
defaultness,

src/librustc/hir/map/def_collector.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
104104
// Pick the def data. This need not be unique, but the more
105105
// information we encapsulate into
106106
let def_data = match i.node {
107-
ItemKind::AutoImpl(..) | ItemKind::Impl(..) =>
108-
DefPathData::Impl,
107+
ItemKind::Impl(..) => DefPathData::Impl,
109108
ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) |
110109
ItemKind::Trait(..) | ItemKind::TraitAlias(..) |
111110
ItemKind::ExternCrate(..) | ItemKind::ForeignMod(..) | ItemKind::Ty(..) =>

src/librustc/hir/map/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,6 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
11921192
ItemTrait(..) => "trait",
11931193
ItemTraitAlias(..) => "trait alias",
11941194
ItemImpl(..) => "impl",
1195-
ItemAutoImpl(..) => "default impl",
11961195
};
11971196
format!("{} {}{}", item_str, path_str(), id_str)
11981197
}

src/librustc/hir/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,10 +1965,6 @@ pub enum Item_ {
19651965
/// Represents a Trait Alias Declaration
19661966
ItemTraitAlias(Generics, TyParamBounds),
19671967

1968-
/// Auto trait implementations
1969-
///
1970-
/// `impl Trait for .. {}`
1971-
ItemAutoImpl(Unsafety, TraitRef),
19721968
/// An implementation, eg `impl<A> Trait for Foo { .. }`
19731969
ItemImpl(Unsafety,
19741970
ImplPolarity,
@@ -1996,8 +1992,7 @@ impl Item_ {
19961992
ItemUnion(..) => "union",
19971993
ItemTrait(..) => "trait",
19981994
ItemTraitAlias(..) => "trait alias",
1999-
ItemImpl(..) |
2000-
ItemAutoImpl(..) => "item",
1995+
ItemImpl(..) => "item",
20011996
}
20021997
}
20031998

src/librustc/hir/print.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -652,18 +652,6 @@ impl<'a> State<'a> {
652652
self.head(&visibility_qualified(&item.vis, "union"))?;
653653
self.print_struct(struct_def, generics, item.name, item.span, true)?;
654654
}
655-
hir::ItemAutoImpl(unsafety, ref trait_ref) => {
656-
self.head("")?;
657-
self.print_visibility(&item.vis)?;
658-
self.print_unsafety(unsafety)?;
659-
self.word_nbsp("impl")?;
660-
self.print_trait_ref(trait_ref)?;
661-
self.s.space()?;
662-
self.word_space("for")?;
663-
self.word_space("..")?;
664-
self.bopen()?;
665-
self.bclose(item.span)?;
666-
}
667655
hir::ItemImpl(unsafety,
668656
polarity,
669657
defaultness,

src/librustc/ich/impls_hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,6 @@ impl_stable_hash_for!(enum hir::Item_ {
854854
ItemUnion(variant_data, generics),
855855
ItemTrait(is_auto, unsafety, generics, bounds, item_refs),
856856
ItemTraitAlias(generics, bounds),
857-
ItemAutoImpl(unsafety, trait_ref),
858857
ItemImpl(unsafety, impl_polarity, impl_defaultness, generics, trait_ref, ty, impl_item_refs)
859858
});
860859

src/librustc/middle/dead.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
564564
hir::ItemStruct(..) |
565565
hir::ItemUnion(..) |
566566
hir::ItemTrait(..) |
567-
hir::ItemAutoImpl(..) |
568567
hir::ItemImpl(..) => self.tcx.sess.codemap().def_span(item.span),
569568
_ => item.span,
570569
};

0 commit comments

Comments
 (0)