diff options
| author | Kyle Simpson <kyleandrew.simpson@gmail.com> | 2018-07-20 14:12:57 +0100 |
|---|---|---|
| committer | Kyle Simpson <kyleandrew.simpson@gmail.com> | 2018-07-20 14:12:57 +0100 |
| commit | 0603a731f40015849e82d4f00c90899bb01898ec (patch) | |
| tree | 020b8af3ce5bbe3141fb1cc4044b87b688d0b522 | |
| parent | 5ba21844f6c85a0cd55c8ea0250d5cd758134f84 (diff) | |
| download | rust-0603a731f40015849e82d4f00c90899bb01898ec.tar.gz rust-0603a731f40015849e82d4f00c90899bb01898ec.zip | |
Add test case for #50865 regression.
| -rw-r--r-- | src/test/run-pass/issue-50865-private-impl-trait/auxiliary/lib.rs | 24 | ||||
| -rw-r--r-- | src/test/run-pass/issue-50865-private-impl-trait/main.rs | 20 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-50865-private-impl-trait/auxiliary/lib.rs b/src/test/run-pass/issue-50865-private-impl-trait/auxiliary/lib.rs new file mode 100644 index 00000000000..bf4f13360be --- /dev/null +++ b/src/test/run-pass/issue-50865-private-impl-trait/auxiliary/lib.rs @@ -0,0 +1,24 @@ +// Copyright 2016 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. + +#![crate_type = "lib"] + +pub fn bar<P>( // Error won't happen if "bar" is not generic + _baz: P, +) { + hide_foo()(); +} + +fn hide_foo() -> impl Fn() { // Error won't happen if "iterate" hasn't impl Trait or has generics + foo +} + +fn foo() { // Error won't happen if "foo" isn't used in "iterate" or has generics +} diff --git a/src/test/run-pass/issue-50865-private-impl-trait/main.rs b/src/test/run-pass/issue-50865-private-impl-trait/main.rs new file mode 100644 index 00000000000..7e92e107981 --- /dev/null +++ b/src/test/run-pass/issue-50865-private-impl-trait/main.rs @@ -0,0 +1,20 @@ +// Copyright 2016 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. + +// aux-build:lib.rs + +// Regression test for #50865. +// FIXME: explain. + +extern crate lib; + +fn main() { + lib::bar(()); // Error won't happen if bar is called from same crate +} |
