rust/tests/ui/delegation/glob-non-fn.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.0 KiB
Rust
Raw Normal View History

2024-03-15 11:21:03 +00:00
#![feature(fn_delegation)]
#![allow(incomplete_features)]
trait Trait {
fn method(&self);
const CONST: u8;
type Type;
#[allow(non_camel_case_types)]
type method;
}
impl Trait for u8 {
fn method(&self) {}
const CONST: u8 = 0;
type Type = u8;
type method = u8;
}
struct Good(u8);
impl Trait for Good {
reuse Trait::* { &self.0 }
// Explicit definitions for non-delegatable items.
const CONST: u8 = 0;
type Type = u8;
type method = u8;
}
struct Bad(u8);
impl Trait for Bad { //~ ERROR not all trait items implemented, missing: `CONST`, `Type`, `method`
reuse Trait::* { &self.0 }
//~^ ERROR item `CONST` is an associated method, which doesn't match its trait `Trait`
//~| ERROR item `Type` is an associated method, which doesn't match its trait `Trait`
//~| ERROR duplicate definitions with name `method`
//~| ERROR expected function, found associated constant `Trait::CONST`
//~| ERROR expected function, found associated type `Trait::Type`
}
fn main() {}