Rename optin_builtin_traits to auto_traits

They were originally called "opt-in, built-in traits" (OIBITs), but
people realized that the name was too confusing and a mouthful, and so
they were renamed to just "auto traits". The feature flag's name wasn't
updated, though, so that's what this PR does.

There are some other spots in the compiler that still refer to OIBITs,
but I don't think changing those now is worth it since they are internal
and not particularly relevant to this PR.

Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
This commit is contained in:
Camelid 2020-11-22 19:54:31 -08:00
parent 32da90b431
commit 810324d1f3
54 changed files with 78 additions and 62 deletions

View File

@ -370,7 +370,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
ast::ItemKind::Trait(ast::IsAuto::Yes, ..) => {
gate_feature_post!(
&self,
optin_builtin_traits,
auto_traits,
i.span,
"auto traits are experimental and possibly buggy"
);

View File

@ -1,6 +1,6 @@
#![feature(
no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
untagged_unions, decl_macro, rustc_attrs, transparent_unions, optin_builtin_traits,
untagged_unions, decl_macro, rustc_attrs, transparent_unions, auto_traits,
thread_local,
)]
#![no_core]

View File

@ -15,7 +15,8 @@
#![feature(fn_traits)]
#![feature(int_bits_const)]
#![feature(min_specialization)]
#![feature(optin_builtin_traits)]
#![cfg_attr(bootstrap, feature(optin_builtin_traits))]
#![cfg_attr(not(bootstrap), feature(auto_traits))]
#![feature(nll)]
#![feature(allow_internal_unstable)]
#![feature(hash_raw_entry)]

View File

@ -16,7 +16,7 @@ unsafe.
This will compile:
```ignore (ignore auto_trait future compatibility warning)
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
struct Foo;

View File

@ -4,7 +4,7 @@ or enum type.
Erroneous code example:
```compile_fail,E0321
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
struct Foo;

View File

@ -3,7 +3,7 @@ Generics have been used on an auto trait.
Erroneous code example:
```compile_fail,E0567
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
auto trait Generic<T> {} // error!
# fn main() {}
@ -16,7 +16,7 @@ parameters.
To fix this issue, just remove the generics:
```
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
auto trait Generic {} // ok!
# fn main() {}

View File

@ -3,7 +3,7 @@ A super trait has been added to an auto trait.
Erroneous code example:
```compile_fail,E0568
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
auto trait Bound : Copy {} // error!
@ -18,7 +18,7 @@ all the existing types could implement `Bound` because very few of them have the
To fix this issue, just remove the super trait:
```
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
auto trait Bound {} // ok!

View File

@ -149,9 +149,6 @@ declare_features! (
/// Allows using the `#[linkage = ".."]` attribute.
(active, linkage, "1.0.0", Some(29603), None),
/// Allows features specific to OIBIT (auto traits).
(active, optin_builtin_traits, "1.0.0", Some(13231), None),
/// Allows using `box` in patterns (RFC 469).
(active, box_patterns, "1.0.0", Some(29641), None),
@ -215,6 +212,10 @@ declare_features! (
/// purpose as `#[allow_internal_unstable]`.
(active, rustc_allow_const_fn_unstable, "1.49.0", Some(69399), None),
/// Allows features specific to auto traits.
/// Renamed from `optin_builtin_traits`.
(active, auto_traits, "1.50.0", Some(13231), None),
// no-tracking-issue-end
// -------------------------------------------------------------------------

View File

@ -71,6 +71,10 @@ declare_features! (
/// Allows using custom attributes (RFC 572).
(removed, custom_attribute, "1.0.0", Some(29642), None,
Some("removed in favor of `#![register_tool]` and `#![register_attr]`")),
/// Allows features specific to OIBIT (now called auto traits).
/// Renamed to `auto_traits`.
(removed, optin_builtin_traits, "1.0.0", Some(13231), None,
Some("renamed to `auto_traits`")),
(removed, pushpop_unsafe, "1.2.0", None, None, None),
(removed, needs_allocator, "1.4.0", Some(27389), None,
Some("subsumed by `#![feature(allocator_internals)]`")),
@ -113,7 +117,6 @@ declare_features! (
Some("removed in favor of `#![feature(marker_trait_attr)]`")),
/// Allows `#[no_debug]`.
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
/// Allows comparing raw pointers during const eval.
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
Some("cannot be allowed in const eval in any meaningful way")),

View File

@ -285,6 +285,7 @@ symbols! {
attr_literals,
attributes,
augmented_assignments,
auto_traits,
automatically_derived,
avx512_target_feature,
await_macro,

View File

@ -112,7 +112,8 @@
#![feature(never_type)]
#![feature(nll)]
#![feature(nonnull_slice_from_raw_parts)]
#![feature(optin_builtin_traits)]
#![cfg_attr(bootstrap, feature(optin_builtin_traits))]
#![cfg_attr(not(bootstrap), feature(auto_traits))]
#![feature(or_patterns)]
#![feature(pattern)]
#![feature(ptr_internals)]

View File

@ -119,7 +119,8 @@
#![feature(nll)]
#![feature(exhaustive_patterns)]
#![feature(no_core)]
#![feature(optin_builtin_traits)]
#![cfg_attr(bootstrap, feature(optin_builtin_traits))]
#![cfg_attr(not(bootstrap), feature(auto_traits))]
#![feature(or_patterns)]
#![feature(prelude_import)]
#![feature(repr_simd, platform_intrinsics)]

View File

@ -28,7 +28,8 @@
#![feature(extern_types)]
#![feature(in_band_lifetimes)]
#![feature(negative_impls)]
#![feature(optin_builtin_traits)]
#![cfg_attr(bootstrap, feature(optin_builtin_traits))]
#![cfg_attr(not(bootstrap), feature(auto_traits))]
#![feature(restricted_std)]
#![feature(rustc_attrs)]
#![feature(min_specialization)]

View File

@ -9,10 +9,13 @@
// headers or footers.
//
// Note that the actual module entry point is located in the C runtime startup
// object (usually called `crtX.o), which then invokes initialization callbacks
// object (usually called `crtX.o`), which then invokes initialization callbacks
// of other runtime components (registered via yet another special image section).
#![feature(no_core, lang_items, optin_builtin_traits)]
#![feature(no_core)]
#![feature(lang_items)]
#![cfg_attr(bootstrap, feature(optin_builtin_traits))]
#![cfg_attr(not(bootstrap), feature(auto_traits))]
#![crate_type = "rlib"]
#![no_core]
#![allow(non_camel_case_types)]

View File

@ -1,6 +1,9 @@
// See rsbegin.rs for details.
#![feature(no_core, lang_items, optin_builtin_traits)]
#![feature(no_core)]
#![feature(lang_items)]
#![cfg_attr(bootstrap, feature(optin_builtin_traits))]
#![cfg_attr(not(bootstrap), feature(auto_traits))]
#![crate_type = "rlib"]
#![no_core]

View File

@ -286,7 +286,8 @@
#![feature(nll)]
#![feature(nonnull_slice_from_raw_parts)]
#![feature(once_cell)]
#![feature(optin_builtin_traits)]
#![cfg_attr(bootstrap, feature(optin_builtin_traits))]
#![cfg_attr(not(bootstrap), feature(auto_traits))]
#![feature(or_patterns)]
#![feature(panic_info_message)]
#![feature(panic_internals)]

View File

@ -1,4 +1,4 @@
# `optin_builtin_traits`
# `auto_traits`
The tracking issue for this feature is [#13231]
@ -6,7 +6,7 @@ The tracking issue for this feature is [#13231]
----
The `optin_builtin_traits` feature gate allows you to define auto traits.
The `auto_traits` feature gate allows you to define auto traits.
Auto traits, like [`Send`] or [`Sync`] in the standard library, are marker traits
that are automatically implemented for every type, unless the type, or a type it contains,
@ -24,7 +24,7 @@ Example:
```rust
#![feature(negative_impls)]
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
auto trait Valid {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
// pp-exact

View File

@ -2,7 +2,7 @@
#![crate_type = "lib"]
// we can compile to a variety of platforms, because we don't need
// cross-compiled standard libraries.
#![feature(no_core, optin_builtin_traits)]
#![feature(no_core, auto_traits)]
#![no_core]
#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items, rustc_attrs)]

View File

@ -1,4 +1,4 @@
#![feature(lang_items, no_core, optin_builtin_traits)]
#![feature(lang_items, no_core, auto_traits)]
#![no_core]
#[lang="copy"]

View File

@ -1,6 +1,6 @@
// aux-build:auto-traits.rs
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![crate_name = "foo"]

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
// @has auto_aliases/trait.Bar.html '//h3[@aliases="auto_aliases::Foo"]' 'impl Bar for Foo'
pub struct Foo;

View File

@ -1,3 +1,3 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
pub unsafe auto trait Bar {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
pub mod bar {
use std::marker;

View File

@ -1,3 +1,3 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
pub auto trait AnOibit {}

View File

@ -1,5 +1,5 @@
#![feature(negative_impls)]
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
pub auto trait AnOibit {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
pub auto trait Banana {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
// edition:2018

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
auto trait Generic<T> {}
//~^ auto traits cannot have generic parameters [E0567]

View File

@ -1,6 +1,6 @@
// run-pass
#![allow(unused_doc_comments)]
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait Auto {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
unsafe auto trait Trait {

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
unsafe auto trait Trait {

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait Magic : Sized where Option<Self> : Magic {} //~ ERROR E0568

View File

@ -22,7 +22,7 @@
// println!("{:?} {:?}", a, b);
// }
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait Magic: Copy {} //~ ERROR E0568

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait MyTrait {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait MyTrait {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait MyTrait {}

View File

@ -3,7 +3,7 @@
// other words, the auto impl only applies if there are no existing
// impls whose types unify.
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait Defaulted { }

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait MySafeTrait {}

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
// Test for issue #56934 - that it is impossible to redundantly

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
// Test for issue #56934 - that it is impossible to redundantly

View File

@ -1,5 +1,5 @@
// Test that default and negative trait implementations are gated by
// `optin_builtin_traits` feature gate
// `auto_traits` feature gate
struct DummyStruct;

View File

@ -1,14 +1,14 @@
error[E0658]: auto traits are experimental and possibly buggy
--> $DIR/feature-gate-optin-builtin-traits.rs:6:1
--> $DIR/feature-gate-auto-traits.rs:6:1
|
LL | auto trait AutoDummyTrait {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
= help: add `#![feature(optin_builtin_traits)]` to the crate attributes to enable
= help: add `#![feature(auto_traits)]` to the crate attributes to enable
error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now
--> $DIR/feature-gate-optin-builtin-traits.rs:9:6
--> $DIR/feature-gate-auto-traits.rs:9:6
|
LL | impl !AutoDummyTrait for DummyStruct {}
| ^^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
#![feature(generators)]
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait Foo {}

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait NotSame {}

View File

@ -1,6 +1,6 @@
// check-pass
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
#![feature(never_type)]

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
#![allow(bare_trait_objects)]

View File

@ -1,7 +1,7 @@
// 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)
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
use std::marker::{PhantomData};

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
#[allow(private_in_public)]

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
pub trait PubPrincipal {}

View File

@ -1,6 +1,6 @@
// Make sure specialization cannot change impl polarity
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete

View File

@ -6,7 +6,7 @@
//[legacy]normalize-stderr-32bit: "hee444285569b39c2" -> "SYMBOL_HASH"
//[legacy]normalize-stderr-64bit: "h310ea0259fc3d32d" -> "SYMBOL_HASH"
#![feature(optin_builtin_traits, rustc_attrs)]
#![feature(auto_traits, rustc_attrs)]
#![allow(dead_code)]
mod foo {

View File

@ -2,7 +2,7 @@
// a simple OIBIT `..` impl alone still doesn't allow arbitrary bounds
// to be synthesized.
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
auto trait Magic: Copy {} //~ ERROR E0568

View File

@ -1,4 +1,4 @@
#![feature(optin_builtin_traits, core)]
#![feature(auto_traits, core)]
#![crate_type = "rlib"]
pub auto trait DefaultedTrait { }