rust/tests/ui/hygiene/impl_items.rs

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

33 lines
468 B
Rust
Raw Normal View History

#![feature(decl_macro)]
2017-03-25 02:37:55 +00:00
mod foo {
struct S;
impl S {
fn f(&self) {}
}
pub macro m() {
2022-09-21 15:57:30 +00:00
let _: () = S.f(); //~ ERROR type `for<'a> fn(&'a foo::S) {foo::S::f}` is private
2017-03-25 02:37:55 +00:00
}
}
struct S;
macro m($f:ident) {
impl S {
fn f(&self) -> u32 { 0 }
fn $f(&self) -> i32 { 0 }
}
fn f() {
let _: u32 = S.f();
let _: i32 = S.$f();
}
}
m!(f);
fn main() {
let _: i32 = S.f();
foo::m!();
}