From b3e1aca40f889a565bfa2607b82b80fe7cbcefea Mon Sep 17 00:00:00 2001 From: Lee Jeffery Date: Tue, 22 Sep 2015 09:06:43 +0100 Subject: [PATCH] Add UFCS privacy test. --- src/test/compile-fail/privacy-ufcs.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/compile-fail/privacy-ufcs.rs diff --git a/src/test/compile-fail/privacy-ufcs.rs b/src/test/compile-fail/privacy-ufcs.rs new file mode 100644 index 0000000000000..ccb379c717928 --- /dev/null +++ b/src/test/compile-fail/privacy-ufcs.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test to ensure private traits are inaccessible with UFCS angle-bracket syntax. + +mod foo { + trait Bar { + fn baz() {} + } + + impl Bar for i32 {} +} + +fn main() { + ::baz(); //~ERROR method `baz` is inaccessible + //~^NOTE: trait `Bar` is private +}