Skip to content

Commit

Permalink
Use the name "auto traits" everywhere in the compiler
Browse files Browse the repository at this point in the history
Goodbye, OIBIT!
  • Loading branch information
camelid committed Nov 25, 2020
1 parent 810324d commit 82dc99b
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ pub struct LocalDecl<'tcx> {
/// after typeck.
///
/// This should be sound because the drop flags are fully algebraic, and
/// therefore don't affect the OIBIT or outlives properties of the
/// therefore don't affect the auto-trait or outlives properties of the
/// generator.
pub internal: bool,

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum Reveal {
/// be observable directly by the user, `Reveal::All`
/// should not be used by checks which may expose
/// type equality or type contents to the user.
/// There are some exceptions, e.g., around OIBITS and
/// There are some exceptions, e.g., around auto traits and
/// transmute-checking, which expose some details, but
/// not the whole concrete type of the `impl Trait`.
All,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
ExprKind::Box { value } => {
let value = this.hir.mirror(value);
// The `Box<T>` temporary created here is not a part of the HIR,
// and therefore is not considered during generator OIBIT
// and therefore is not considered during generator auto-trait
// determination. See the comment about `box` at `yield_in_scope`.
let result = this.local_decls.push(LocalDecl::new(expr.ty, expr_span).internal());
this.cfg.push(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#![feature(auto_traits)]

pub auto trait AnOibit {}
pub auto trait AnAutoTrait {}
6 changes: 3 additions & 3 deletions src/test/rustdoc/impl-parts-crosscrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ pub struct Bar<T> { t: T }
// full impl string. Instead, just make sure something from each part
// is mentioned.

// @has implementors/rustdoc_impl_parts_crosscrate/trait.AnOibit.js Bar
// @has implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar
// @has - Send
// @has - !AnOibit
// @has - !AnAutoTrait
// @has - Copy
impl<T: Send> !rustdoc_impl_parts_crosscrate::AnOibit for Bar<T>
impl<T: Send> !rustdoc_impl_parts_crosscrate::AnAutoTrait for Bar<T>
where T: Copy {}
10 changes: 5 additions & 5 deletions src/test/rustdoc/impl-parts.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![feature(negative_impls)]
#![feature(auto_traits)]

pub auto trait AnOibit {}
pub auto trait AnAutoTrait {}

pub struct Foo<T> { field: T }

// @has impl_parts/struct.Foo.html '//*[@class="impl"]//code' \
// "impl<T: Clone> !AnOibit for Foo<T> where T: Sync,"
// @has impl_parts/trait.AnOibit.html '//*[@class="item-list"]//code' \
// "impl<T: Clone> !AnOibit for Foo<T> where T: Sync,"
impl<T: Clone> !AnOibit for Foo<T> where T: Sync {}
// "impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync,"
// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//code' \
// "impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync,"
impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Ensure that OIBIT checks `T` when it encounters a `PhantomData<T>` field, instead of checking
// the `PhantomData<T>` type itself (which almost always implements an auto trait)
// Ensure that auto trait checks `T` when it encounters a `PhantomData<T>` field, instead of
// checking the `PhantomData<T>` type itself (which almost always implements an auto trait).

#![feature(auto_traits)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: `T` cannot be shared between threads safely
--> $DIR/phantom-oibit.rs:21:12
--> $DIR/phantom-auto-trait.rs:21:12
|
LL | fn is_zen<T: Zen>(_: T) {}
| --- required by this bound in `is_zen`
Expand All @@ -16,7 +16,7 @@ LL | fn not_sync<T: Sync>(x: Guard<T>) {
| ^^^^^^

error[E0277]: `T` cannot be shared between threads safely
--> $DIR/phantom-oibit.rs:26:12
--> $DIR/phantom-auto-trait.rs:26:12
|
LL | fn is_zen<T: Zen>(_: T) {}
| --- required by this bound in `is_zen`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// OIBIT-based version of #29859, supertrait version. Test that using
// a simple OIBIT `..` impl alone still doesn't allow arbitrary bounds
// Auto-trait-based version of #29859, supertrait version. Test that using
// a simple auto trait `..` impl alone still doesn't allow arbitrary bounds
// to be synthesized.

#![feature(auto_traits)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0568]: auto traits cannot have super traits
--> $DIR/traits-inductive-overflow-supertrait-oibit.rs:8:19
--> $DIR/traits-inductive-overflow-supertrait-auto-trait.rs:8:19
|
LL | auto trait Magic: Copy {}
| ----- ^^^^ help: remove the super traits
| |
| auto trait cannot have super traits

error[E0277]: the trait bound `NoClone: Copy` is not satisfied
--> $DIR/traits-inductive-overflow-supertrait-oibit.rs:16:23
--> $DIR/traits-inductive-overflow-supertrait-auto-trait.rs:16:23
|
LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
| ----- required by this bound in `copy`
Expand Down

0 comments on commit 82dc99b

Please sign in to comment.