Fix for middle::reachable + better comments and tests
In `middle::reachable` mark default impl of a trait method as reachable if this trait method is used from inlinable code
This commit is contained in:
parent
8cef018d52
commit
243a524d06
4 changed files with 65 additions and 60 deletions
29
src/test/auxiliary/issue-11225-3.rs
Normal file
29
src/test/auxiliary/issue-11225-3.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// 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 <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.
|
||||
|
||||
trait PrivateTrait {
|
||||
fn private_trait_method(&self);
|
||||
}
|
||||
|
||||
struct PrivateStruct;
|
||||
|
||||
impl PrivateStruct {
|
||||
fn private_inherent_method(&self) { }
|
||||
}
|
||||
|
||||
impl PrivateTrait for PrivateStruct {
|
||||
fn private_trait_method(&self) { }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn public_generic_function() {
|
||||
PrivateStruct.private_trait_method();
|
||||
PrivateStruct.private_inherent_method();
|
||||
}
|
||||
19
src/test/run-pass/issue-11225-3.rs
Normal file
19
src/test/run-pass/issue-11225-3.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// 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 <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:issue-11225-3.rs
|
||||
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
extern crate issue_11225_3;
|
||||
|
||||
pub fn main() {
|
||||
issue_11225_3::public_generic_function();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue