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-24 21:37:55 -05:00
mod foo {
struct S;
impl S {
fn f(&self) {}
}
pub macro m() {
2022-09-21 10:57:30 -05:00
let _: () = S.f(); //~ ERROR type `for<'a> fn(&'a foo::S) {foo::S::f}` is private
2017-03-24 21:37:55 -05: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!();
}