Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename optin_builtin_traits to auto_traits #79336

Merged
merged 2 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/example/mini_core.rs
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/src/error_codes/E0198.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ unsafe.
This will compile:

```ignore (ignore auto_trait future compatibility warning)
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

struct Foo;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/src/error_codes/E0321.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ or enum type.
Erroneous code example:

```compile_fail,E0321
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

struct Foo;

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0567.md
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand All @@ -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() {}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0568.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand All @@ -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!

Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down Expand Up @@ -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

// -------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_feature/src/removed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]`")),
Expand Down Expand Up @@ -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")),
Expand Down
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
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ symbols! {
attr_literals,
attributes,
augmented_assignments,
auto_traits,
automatically_derived,
avx512_target_feature,
await_macro,
Expand Down
3 changes: 2 additions & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 2 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 2 additions & 1 deletion library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
7 changes: 5 additions & 2 deletions library/rtstartup/rsbegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
5 changes: 4 additions & 1 deletion library/rtstartup/rsend.rs
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
3 changes: 2 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# `optin_builtin_traits`
# `auto_traits`

The tracking issue for this feature is [#13231]

[#13231]: https://github.com/rust-lang/rust/issues/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,
Expand All @@ -24,7 +24,7 @@ Example:

```rust
#![feature(negative_impls)]
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

auto trait Valid {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/pretty/auto-trait.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

// pp-exact

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make-fulldeps/simd-ffi/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make-fulldeps/target-specs/foo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(lang_items, no_core, optin_builtin_traits)]
#![feature(lang_items, no_core, auto_traits)]
#![no_core]

#[lang="copy"]
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/auto-traits.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// aux-build:auto-traits.rs

#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

#![crate_name = "foo"]

Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/auto_aliases.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/auxiliary/auto-traits.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

pub unsafe auto trait Bar {}
2 changes: 1 addition & 1 deletion src/test/rustdoc/auxiliary/rustdoc-default-impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

pub mod bar {
use std::marker;
Expand Down
4 changes: 2 additions & 2 deletions src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#![feature(optin_builtin_traits)]
#![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 {}
12 changes: 6 additions & 6 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(optin_builtin_traits)]
#![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 {}
2 changes: 1 addition & 1 deletion src/test/rustdoc/synthetic_auto/crate-local.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

pub auto trait Banana {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/issue-64130-3-other.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]
// edition:2018

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/auto-traits/auto-trait-validation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]

auto trait Generic<T> {}
//~^ auto traits cannot have generic parameters [E0567]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/auto-traits/auto-traits.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// run-pass
#![allow(unused_doc_comments)]
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]

auto trait Auto {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/auto-traits/issue-23080-2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]

unsafe auto trait Trait {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/auto-traits/issue-23080.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]

unsafe auto trait Trait {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]

auto trait Magic : Sized where Option<Self> : Magic {} //~ ERROR E0568
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// println!("{:?} {:?}", a, b);
// }

#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]

auto trait Magic: Copy {} //~ ERROR E0568
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]

auto trait MyTrait {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(optin_builtin_traits)]
#![feature(auto_traits)]
#![feature(negative_impls)]

auto trait MyTrait {}
Expand Down
Loading