Auto merge of #42809 - seanmonstar:stable-associated-consts, r=nikomatsakis

remove associated_consts feature gate

Currently struggling to run tests locally (something about jemalloc target missing).

cc #29646
This commit is contained in:
bors 2017-07-07 18:42:14 +00:00
commit 13157c4ebc
87 changed files with 64 additions and 266 deletions

View File

@ -1,85 +0,0 @@
# `associated_consts`
The tracking issue for this feature is: [#29646]
[#29646]: https://github.com/rust-lang/rust/issues/29646
------------------------
With the `associated_consts` feature, you can define constants like this:
```rust
#![feature(associated_consts)]
trait Foo {
const ID: i32;
}
impl Foo for i32 {
const ID: i32 = 1;
}
fn main() {
assert_eq!(1, i32::ID);
}
```
Any implementor of `Foo` will have to define `ID`. Without the definition:
```rust,ignore
#![feature(associated_consts)]
trait Foo {
const ID: i32;
}
impl Foo for i32 {
}
```
gives
```text
error: not all trait items implemented, missing: `ID` [E0046]
impl Foo for i32 {
}
```
A default value can be implemented as well:
```rust
#![feature(associated_consts)]
trait Foo {
const ID: i32 = 1;
}
impl Foo for i32 {
}
impl Foo for i64 {
const ID: i32 = 5;
}
fn main() {
assert_eq!(1, i32::ID);
assert_eq!(5, i64::ID);
}
```
As you can see, when implementing `Foo`, you can leave it unimplemented, as
with `i32`. It will then use the default value. But, as in `i64`, we can also
add our own definition.
Associated constants dont have to be associated with a trait. An `impl` block
for a `struct` or an `enum` works fine too:
```rust
#![feature(associated_consts)]
struct Foo;
impl Foo {
const FOO: u32 = 3;
}
```

View File

@ -70,7 +70,6 @@
#![feature(allow_internal_unstable)]
#![feature(asm)]
#![feature(associated_type_defaults)]
#![feature(associated_consts)]
#![feature(cfg_target_feature)]
#![feature(cfg_target_has_atomic)]
#![feature(concat_idents)]
@ -94,6 +93,8 @@
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
#![cfg_attr(stage0, feature(associated_consts))]
#[prelude_import]
#[allow(unused)]
use prelude::v1::*;

View File

@ -22,7 +22,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(associated_consts)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(conservative_impl_trait)]
@ -42,6 +41,8 @@
#![feature(trace_macros)]
#![feature(test)]
#![cfg_attr(stage0, feature(associated_consts))]
#![recursion_limit="256"]
extern crate arena;

View File

@ -10,11 +10,12 @@
#![crate_name = "rustc_bitflags"]
#![feature(associated_consts)]
#![crate_type = "rlib"]
#![no_std]
#![deny(warnings)]
#![cfg_attr(stage0, feature(associated_consts))]
//! A typesafe bitmask flag generator.
#[cfg(test)]
@ -31,7 +32,6 @@ extern crate std;
///
/// ```{.rust}
/// #![feature(rustc_private)]
/// #![feature(associated_consts)]
/// #[macro_use] extern crate rustc_bitflags;
///
/// bitflags! {

View File

@ -20,7 +20,8 @@
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(associated_consts)]
#![cfg_attr(stage0, feature(associated_consts))]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;

View File

@ -29,7 +29,6 @@
#![feature(nonzero)]
#![feature(unboxed_closures)]
#![feature(fn_traits)]
#![feature(associated_consts)]
#![feature(unsize)]
#![feature(i128_type)]
#![feature(conservative_impl_trait)]
@ -37,6 +36,7 @@
#![feature(specialization)]
#![feature(manually_drop)]
#![cfg_attr(stage0, feature(associated_consts))]
#![cfg_attr(stage0, feature(struct_field_attributes))]
#![cfg_attr(unix, feature(libc))]

View File

@ -21,13 +21,14 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(associated_consts)]
#![feature(box_syntax)]
#![feature(concat_idents)]
#![feature(libc)]
#![feature(link_args)]
#![feature(static_nobundle)]
#![cfg_attr(stage0, feature(associated_consts))]
extern crate libc;
#[macro_use]
#[no_link]

View File

@ -19,7 +19,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![crate_type = "dylib"]
#![deny(warnings)]
#![feature(associated_consts)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(i128_type)]
@ -28,6 +27,8 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(collection_placement)]
#![feature(nonzero)]
#![cfg_attr(stage0, feature(associated_consts))]
#[macro_use] extern crate log;
extern crate graphviz as dot;
#[macro_use]

View File

@ -1320,8 +1320,6 @@ match the name of any associated constant in the trait.
Erroneous code example:
```compile_fail,E0438
#![feature(associated_consts)]
trait Foo {}
impl Foo for i32 {

View File

@ -16,9 +16,10 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(associated_consts)]
#![feature(rustc_diagnostic_macros)]
#![cfg_attr(stage0, feature(associated_consts))]
#[macro_use]
extern crate log;
#[macro_use]

View File

@ -22,7 +22,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
#![feature(associated_consts)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_fn)]
@ -35,6 +34,8 @@
#![feature(slice_patterns)]
#![feature(conservative_impl_trait)]
#![cfg_attr(stage0, feature(associated_consts))]
use rustc::dep_graph::WorkProduct;
use syntax_pos::symbol::Symbol;

View File

@ -2777,8 +2777,6 @@ An associated const was implemented when another trait item was expected.
Erroneous code example:
```compile_fail,E0323
#![feature(associated_consts)]
trait Foo {
type N;
}
@ -2810,8 +2808,6 @@ impl Foo for Bar {
Or:
```
#![feature(associated_consts)]
struct Bar;
trait Foo {
@ -2829,8 +2825,6 @@ A method was implemented when another trait item was expected. Erroneous
code example:
```compile_fail,E0324
#![feature(associated_consts)]
struct Bar;
trait Foo {
@ -2850,8 +2844,6 @@ To fix this error, please verify that the method name wasn't misspelled and
verify that you are indeed implementing the correct trait items. Example:
```
#![feature(associated_consts)]
struct Bar;
trait Foo {
@ -2873,8 +2865,6 @@ An associated type was implemented when another trait item was expected.
Erroneous code example:
```compile_fail,E0325
#![feature(associated_consts)]
struct Bar;
trait Foo {
@ -2906,8 +2896,6 @@ impl Foo for Bar {
Or:
```
#![feature(associated_consts)]
struct Bar;
trait Foo {
@ -2927,8 +2915,6 @@ types in the trait definition. This error indicates that there was a mismatch.
Here's an example of this error:
```compile_fail,E0326
#![feature(associated_consts)]
trait Foo {
const BAR: bool;
}
@ -2991,8 +2977,6 @@ type parameter or `Self`. This is not supported yet. An example causing this
error is shown below:
```
#![feature(associated_consts)]
trait Foo {
const BAR: f64;
}
@ -3012,8 +2996,6 @@ Currently, the value of `BAR` for a particular type can only be accessed
through a concrete type, as shown below:
```
#![feature(associated_consts)]
trait Foo {
const BAR: f64;
}

View File

@ -245,7 +245,6 @@
#![feature(allocator_internals)]
#![feature(allow_internal_unstable)]
#![feature(asm)]
#![feature(associated_consts)]
#![feature(box_syntax)]
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_thread_local)]
@ -320,6 +319,7 @@
#![cfg_attr(test, feature(float_bits_conv))]
#![cfg_attr(not(stage0), default_lib_allocator)]
#![cfg_attr(stage0, feature(associated_consts))]
// Explicitly import the prelude. The compiler uses this same unstable attribute
// to import the prelude implicitly when building crates that depend on std.

View File

@ -198,10 +198,6 @@ declare_features! (
// #23121. Array patterns have some hazards yet.
(active, slice_patterns, "1.0.0", Some(23121)),
// Allows the definition of associated constants in `trait` or `impl`
// blocks.
(active, associated_consts, "1.0.0", Some(29646)),
// Allows the definition of `const fn` functions.
(active, const_fn, "1.2.0", Some(24111)),
@ -446,6 +442,9 @@ declare_features! (
(accepted, closure_to_fn_coercion, "1.19.0", Some(39817)),
// Allows attributes on struct literal fields.
(accepted, struct_field_attributes, "1.20.0", Some(38814)),
// Allows the definition of associated constants in `trait` or `impl`
// blocks.
(accepted, associated_consts, "1.20.0", Some(29646)),
);
// If you change this, please modify src/doc/unstable-book as well. You must
@ -1405,11 +1404,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) {
match ti.node {
ast::TraitItemKind::Const(..) => {
gate_feature_post!(&self, associated_consts,
ti.span,
"associated constants are experimental")
}
ast::TraitItemKind::Method(ref sig, ref block) => {
if block.is_none() {
self.check_abi(sig.abi, ti.span);
@ -1435,11 +1429,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
match ii.node {
ast::ImplItemKind::Const(..) => {
gate_feature_post!(&self, associated_consts,
ii.span,
"associated constants are experimental")
}
ast::ImplItemKind::Method(ref sig, _) => {
if sig.constness.node == ast::Constness::Const {
gate_feature_post!(&self, const_fn, ii.span, "const fn is unstable");

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub use self::sub::{Bar, Baz};

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
enum Foo {}

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Bar {}

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const ID: i32;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const ID: usize;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![deny(dead_code)]
struct MyFoo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
type Out: Sized;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const NAME: &'static str;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const BAR: u32; //~ NOTE type in trait

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const ID: i32;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
mod bar1 {
pub use self::bar2::Foo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub enum EFoo { A, B, C, D }

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub trait Foo {
const Y: usize;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub trait Foo {
const Y: usize;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![deny(non_upper_case_globals)]
#![allow(dead_code)]

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
struct Foo;

View File

@ -10,7 +10,6 @@
// Test for issue #23969
#![feature(associated_consts)]
trait Foo {
type Ty;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![feature(associated_type_defaults)]
pub trait Tr {

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub trait Trait {
const CONST: u32;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub use self::sub::{Bar, Baz};

View File

@ -1,23 +0,0 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// gate-test-associated_consts
trait MyTrait {
const C: bool;
//~^ associated constants are experimental
}
struct Foo;
impl Foo {
const C: bool = true;
//~^ associated constants are experimental
}

View File

@ -10,7 +10,6 @@
// Can't use constants as tuple struct patterns
#![feature(associated_consts)]
const C1: i32 = 0;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
enum Enum<T: Trait> {
X = Trait::Number,

View File

@ -10,7 +10,6 @@
// aux-build:issue_41549.rs
#![feature(associated_consts)]
extern crate issue_41549;

View File

@ -11,7 +11,6 @@
// Check that we correctly prevent users from making trait objects
// from traits with associated consts.
#![feature(associated_consts)]
trait Bar {
const X: usize;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![feature(optin_builtin_traits)]
trait MarkerTr {}

View File

@ -11,7 +11,6 @@
// Private types and traits are not allowed in public interfaces.
// This test also ensures that the checks are performed even inside private modules.
#![feature(associated_consts)]
#![feature(associated_type_defaults)]
#![deny(private_in_public)]
#![allow(unused)]

View File

@ -11,7 +11,6 @@
// Private types and traits are not allowed in public interfaces.
// This test also ensures that the checks are performed even inside private modules.
#![feature(associated_consts)]
#![feature(associated_type_defaults)]
mod types {

View File

@ -9,7 +9,6 @@
// except according to those terms.
#![feature(custom_attribute)]
#![feature(associated_consts)]
macro_rules! stmt_mac {
() => {

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait A { }

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![feature(associated_type_defaults)]
struct S;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
use Trait::foo;
//~^ ERROR `foo` is not directly importable

View File

@ -30,7 +30,6 @@
#![crate_type="rlib"]
#![feature(associated_type_defaults)]
#![feature(intrinsics)]
#![feature(associated_consts)]
// Change trait visibility --------------------------------------------------------

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const NUM: usize;

View File

@ -10,7 +10,6 @@
// aux-build:associated-const-cc-lib.rs
#![feature(associated_consts)]
extern crate associated_const_cc_lib as foolib;

View File

@ -10,7 +10,6 @@
// aux-build:associated-const-cc-lib.rs
#![feature(associated_consts)]
extern crate associated_const_cc_lib as foolib;

View File

@ -10,7 +10,6 @@
// aux-build:associated-const-cc-lib.rs
#![feature(associated_consts)]
extern crate associated_const_cc_lib as foolib;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
struct Foo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
struct Foo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![deny(dead_code)]

View File

@ -10,7 +10,6 @@
// aux-build:empty-struct.rs
#![feature(associated_consts)]
extern crate empty_struct;
use empty_struct::XEmpty2 as XFoo;

View File

@ -7,7 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Lattice {
const BOTTOM: Self;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const ID: i32 = 2;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
mod bar1 {
pub use self::bar2::Foo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
struct Foo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
struct MyType;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait MyInt {
const ONE: Self;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const X: i32;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const ID: i32;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const ID: i32 = 1;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
// The main purpose of this test is to ensure that different impls of the same
// trait can refer to each other without setting off the static recursion check

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Foo {
const ID: i32;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![crate_type="lib"]

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#![deny(dead_code)]
// use different types / traits to test all combinations

View File

@ -10,7 +10,6 @@
// #24947 ICE using a trait-associated const in an array size
#![feature(associated_consts)]
struct Foo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
struct S;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait HasNumber<T> {
const Number: usize;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
#[derive(Clone, Copy, Debug)]
struct Bar;

View File

@ -10,7 +10,6 @@
// Regression test for issue #31267
#![feature(associated_consts)]
struct Foo;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
macro_rules! m { () => { 0 } }

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub trait Foo {
// @has assoc_consts/trait.Foo.html '//*[@class="rust trait"]' \

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub trait Foo {
const FOO: usize;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
use std::marker::PhantomData;

View File

@ -9,7 +9,6 @@
// except according to those terms.
#![feature(associated_type_defaults)]
#![feature(associated_consts)]
// @has issue_28478/trait.Bar.html
pub trait Bar {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts, associated_types)]
// Test that associated item impls on primitive types don't crash rustdoc
pub trait Foo {

View File

@ -11,7 +11,6 @@
// Ensure constant and array length values are not taken from source
// code, which wreaks havoc with macros.
#![feature(associated_consts)]
macro_rules! make {
($n:expr) => {

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
pub trait X {
const CONSTANT: u32;

View File

@ -10,7 +10,6 @@
// aux-build:m1.rs
#![feature(associated_consts)]
extern crate m1;

View File

@ -1,10 +1,10 @@
error[E0601]: main function not found
error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`
--> $DIR/m2.rs:20:1
--> $DIR/m2.rs:19:1
|
20 | / impl m1::X for X {
21 | | }
19 | / impl m1::X for X {
20 | | }
| |_^ missing `CONSTANT`, `Type`, `method` in implementation
|
= note: `CONSTANT` from trait: `const CONSTANT: u32;`

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
use std::fmt::Debug;

View File

@ -1,86 +1,86 @@
error[E0437]: type `bar` is not a member of trait `Foo`
--> $DIR/impl-wrong-item-for-trait.rs:47:5
--> $DIR/impl-wrong-item-for-trait.rs:46:5
|
47 | type bar = u64;
46 | type bar = u64;
| ^^^^^^^^^^^^^^^ not a member of trait `Foo`
error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`
--> $DIR/impl-wrong-item-for-trait.rs:25:5
--> $DIR/impl-wrong-item-for-trait.rs:24:5
|
16 | fn bar(&self);
15 | fn bar(&self);
| -------------- item in trait
...
25 | const bar: u64 = 1;
24 | const bar: u64 = 1;
| ^^^^^^^^^^^^^^^^^^^ does not match trait
error[E0046]: not all trait items implemented, missing: `bar`
--> $DIR/impl-wrong-item-for-trait.rs:22:1
--> $DIR/impl-wrong-item-for-trait.rs:21:1
|
16 | fn bar(&self);
15 | fn bar(&self);
| -------------- `bar` from trait
...
22 | / impl Foo for FooConstForMethod {
23 | | //~^ ERROR E0046
24 | | //~| NOTE missing `bar` in implementation
25 | | const bar: u64 = 1;
21 | / impl Foo for FooConstForMethod {
22 | | //~^ ERROR E0046
23 | | //~| NOTE missing `bar` in implementation
24 | | const bar: u64 = 1;
... |
28 | | const MY_CONST: u32 = 1;
29 | | }
27 | | const MY_CONST: u32 = 1;
28 | | }
| |_^ missing `bar` in implementation
error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo`
--> $DIR/impl-wrong-item-for-trait.rs:37:5
--> $DIR/impl-wrong-item-for-trait.rs:36:5
|
17 | const MY_CONST: u32;
16 | const MY_CONST: u32;
| -------------------- item in trait
...
37 | fn MY_CONST() {}
36 | fn MY_CONST() {}
| ^^^^^^^^^^^^^^^^ does not match trait
error[E0046]: not all trait items implemented, missing: `MY_CONST`
--> $DIR/impl-wrong-item-for-trait.rs:33:1
--> $DIR/impl-wrong-item-for-trait.rs:32:1
|
17 | const MY_CONST: u32;
16 | const MY_CONST: u32;
| -------------------- `MY_CONST` from trait
...
33 | / impl Foo for FooMethodForConst {
34 | | //~^ ERROR E0046
35 | | //~| NOTE missing `MY_CONST` in implementation
36 | | fn bar(&self) {}
32 | / impl Foo for FooMethodForConst {
33 | | //~^ ERROR E0046
34 | | //~| NOTE missing `MY_CONST` in implementation
35 | | fn bar(&self) {}
... |
39 | | //~| NOTE does not match trait
40 | | }
38 | | //~| NOTE does not match trait
39 | | }
| |_^ missing `MY_CONST` in implementation
error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo`
--> $DIR/impl-wrong-item-for-trait.rs:47:5
--> $DIR/impl-wrong-item-for-trait.rs:46:5
|
16 | fn bar(&self);
15 | fn bar(&self);
| -------------- item in trait
...
47 | type bar = u64;
46 | type bar = u64;
| ^^^^^^^^^^^^^^^ does not match trait
error[E0046]: not all trait items implemented, missing: `bar`
--> $DIR/impl-wrong-item-for-trait.rs:44:1
--> $DIR/impl-wrong-item-for-trait.rs:43:1
|
16 | fn bar(&self);
15 | fn bar(&self);
| -------------- `bar` from trait
...
44 | / impl Foo for FooTypeForMethod {
45 | | //~^ ERROR E0046
46 | | //~| NOTE missing `bar` in implementation
47 | | type bar = u64;
43 | / impl Foo for FooTypeForMethod {
44 | | //~^ ERROR E0046
45 | | //~| NOTE missing `bar` in implementation
46 | | type bar = u64;
... |
50 | | const MY_CONST: u32 = 1;
51 | | }
49 | | const MY_CONST: u32 = 1;
50 | | }
| |_^ missing `bar` in implementation
error[E0046]: not all trait items implemented, missing: `fmt`
--> $DIR/impl-wrong-item-for-trait.rs:53:1
--> $DIR/impl-wrong-item-for-trait.rs:52:1
|
53 | / impl Debug for FooTypeForMethod {
54 | | }
52 | / impl Debug for FooTypeForMethod {
53 | | }
| |_^ missing `fmt` in implementation
|
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(associated_consts)]
trait Tr {
const C: Self;

View File

@ -1,7 +1,7 @@
error[E0277]: the trait bound `u8: Tr` is not satisfied
--> $DIR/issue-29595.rs:18:17
--> $DIR/issue-29595.rs:17:17
|
18 | let a: u8 = Tr::C; //~ ERROR the trait bound `u8: Tr` is not satisfied
17 | let a: u8 = Tr::C; //~ ERROR the trait bound `u8: Tr` is not satisfied
| ^^^^^ the trait `Tr` is not implemented for `u8`
|
= note: required by `Tr::C`