Skip to content

Commit 341bfe4

Browse files
authored
Merge pull request #36538 from brson/beta-next
Beta backports
2 parents bf91022 + ca42e0d commit 341bfe4

File tree

8 files changed

+48
-4
lines changed

8 files changed

+48
-4
lines changed

src/librustc/lint/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ declare_lint! {
114114

115115
declare_lint! {
116116
pub PRIVATE_IN_PUBLIC,
117-
Deny,
117+
Warn,
118118
"detect private items in public interfaces not caught by the old implementation"
119119
}
120120

src/librustc/ty/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -803,10 +803,10 @@ impl<'a, 'gcx, 'tcx> Layout {
803803
ty::TyRef(_, ty::TypeAndMut { ty: pointee, .. }) |
804804
ty::TyRawPtr(ty::TypeAndMut { ty: pointee, .. }) => {
805805
let non_zero = !ty.is_unsafe_ptr();
806+
let pointee = normalize_associated_type(infcx, pointee);
806807
if pointee.is_sized(tcx, &infcx.parameter_environment, DUMMY_SP) {
807808
Scalar { value: Pointer, non_zero: non_zero }
808809
} else {
809-
let pointee = normalize_associated_type(infcx, pointee);
810810
let unsized_part = tcx.struct_tail(pointee);
811811
let meta = match unsized_part.sty {
812812
ty::TySlice(_) | ty::TyStr => {

src/librustc_privacy/diagnostics.rs

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ A private trait was used on a public type parameter bound. Erroneous code
1717
examples:
1818
1919
```compile_fail,E0445
20+
#![deny(private_in_public)]
21+
2022
trait Foo {
2123
fn dummy(&self) { }
2224
}
@@ -45,6 +47,8 @@ E0446: r##"
4547
A private type was used in a public type signature. Erroneous code example:
4648
4749
```compile_fail,E0446
50+
#![deny(private_in_public)]
51+
4852
mod Foo {
4953
struct Bar(u32);
5054

src/test/compile-fail/issue-28514.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(private_in_public)]
12+
1113
pub use inner::C;
1214

1315
mod inner {

src/test/compile-fail/issue-30079.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(private_in_public)]
1112
#![allow(unused)]
1213

1314
struct SemiPriv;

src/test/compile-fail/private-in-public-warn.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
#![feature(associated_consts)]
1515
#![feature(associated_type_defaults)]
16-
#![allow(dead_code)]
17-
#![allow(unused_variables)]
16+
#![deny(private_in_public)]
17+
#![allow(unused)]
1818
#![allow(improper_ctypes)]
1919

2020
mod types {

src/test/compile-fail/private-variant-and-crate-reexport.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![deny(private_in_public)]
1112
#![allow(dead_code)]
1213

1314
extern crate core;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Issue 36036: computing the layout of a type composed from another
12+
// trait's associated type caused compiler to ICE when the associated
13+
// type was allowed to be unsized, even though the known instantiated
14+
// type is itself sized.
15+
16+
#![allow(dead_code)]
17+
18+
trait Context {
19+
type Container: ?Sized;
20+
}
21+
22+
impl Context for u16 {
23+
type Container = u8;
24+
}
25+
26+
struct Wrapper<C: Context+'static> {
27+
container: &'static C::Container
28+
}
29+
30+
fn foobar(_: Wrapper<u16>) {}
31+
32+
static VALUE: u8 = 0;
33+
34+
fn main() {
35+
foobar(Wrapper { container: &VALUE });
36+
}

0 commit comments

Comments
 (0)