Merge from rustc

This commit is contained in:
Ben Kimock 2023-05-28 22:03:06 -04:00
commit fe69acfdf0
264 changed files with 5364 additions and 3471 deletions

View file

@ -104,13 +104,17 @@ fn runtest(me: &str) {
"bad output3: {}", s);
// Make sure a stack trace isn't printed too many times
//
// Currently it is printed 3 times ("once", "twice" and "panic in a
// function that cannot unwind") but in the future the last one may be
// removed.
let p = template(me).arg("double-fail")
.env("RUST_BACKTRACE", "1").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(&out.stderr).unwrap();
let mut i = 0;
for _ in 0..2 {
for _ in 0..3 {
i += s[i + 10..].find("stack backtrace").unwrap() + 10;
}
assert!(s[i + 10..].find("stack backtrace").is_none(),

View file

@ -4,7 +4,7 @@ error[E0712]: thread-local variable borrowed past end of function
LL | assert_static(&FOO);
| ^^^^ thread-local variables cannot be borrowed beyond the end of the function
LL | }
| - end of enclosing function is here
| - end of enclosing function is here
error: aborting due to previous error

View file

@ -8,7 +8,6 @@ fn a() {
//~^ NOTE `vec[_]` is borrowed here
vec[0] = Box::new(4); //~ ERROR cannot assign
//~^ NOTE `vec[_]` is assigned to here
//~| NOTE in this expansion of desugaring of drop and replace
_a.use_ref();
//~^ NOTE borrow later used here
}
@ -23,7 +22,6 @@ fn b() {
//~^ `vec[_]` is borrowed here
vec[0] = Box::new(4); //~ ERROR cannot assign
//~^ NOTE `vec[_]` is assigned to here
//~| NOTE in this expansion of desugaring of drop and replace
_b.use_ref();
//~^ NOTE borrow later used here
}

View file

@ -6,24 +6,24 @@ LL | [box ref _a, _, _] => {
LL |
LL | vec[0] = Box::new(4);
| ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
...
LL |
LL | _a.use_ref();
| ------------ borrow later used here
error[E0506]: cannot assign to `vec[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:24:13
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
|
LL | &mut [ref _b @ ..] => {
| ------ `vec[_]` is borrowed here
LL |
LL | vec[0] = Box::new(4);
| ^^^^^^ `vec[_]` is assigned to here but it was already borrowed
...
LL |
LL | _b.use_ref();
| ------------ borrow later used here
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:36:11
--> $DIR/borrowck-vec-pattern-nesting.rs:34:11
|
LL | match vec {
| ^^^ cannot move out of here
@ -41,7 +41,7 @@ LL + [_a,
|
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:48:13
--> $DIR/borrowck-vec-pattern-nesting.rs:46:13
|
LL | let a = vec[0];
| ^^^^^^
@ -55,7 +55,7 @@ LL | let a = &vec[0];
| +
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:57:11
--> $DIR/borrowck-vec-pattern-nesting.rs:55:11
|
LL | match vec {
| ^^^ cannot move out of here
@ -73,7 +73,7 @@ LL + [
|
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:67:13
--> $DIR/borrowck-vec-pattern-nesting.rs:65:13
|
LL | let a = vec[0];
| ^^^^^^
@ -87,7 +87,7 @@ LL | let a = &vec[0];
| +
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:76:11
--> $DIR/borrowck-vec-pattern-nesting.rs:74:11
|
LL | match vec {
| ^^^ cannot move out of here
@ -106,7 +106,7 @@ LL + [_a, _b, _c] => {}
|
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:87:13
--> $DIR/borrowck-vec-pattern-nesting.rs:85:13
|
LL | let a = vec[0];
| ^^^^^^

View file

@ -5,7 +5,6 @@ fn test_drop_replace() {
b = Box::new(1); //~ NOTE first assignment
b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
//~| NOTE cannot assign twice to immutable
//~| NOTE in this expansion of desugaring of drop and replace
}
fn test_call() {
@ -14,14 +13,12 @@ fn test_call() {
//~| SUGGESTION mut b
b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
//~| NOTE cannot assign twice to immutable
//~| NOTE in this expansion of desugaring of drop and replace
}
fn test_args(b: Box<i32>) { //~ HELP consider making this binding mutable
//~| SUGGESTION mut b
b = Box::new(2); //~ ERROR cannot assign to immutable argument `b`
//~| NOTE cannot assign to immutable argument
//~| NOTE in this expansion of desugaring of drop and replace
}
fn main() {}

View file

@ -10,7 +10,7 @@ LL | b = Box::new(2);
| ^ cannot assign twice to immutable variable
error[E0384]: cannot assign twice to immutable variable `b`
--> $DIR/issue-45199.rs:15:5
--> $DIR/issue-45199.rs:14:5
|
LL | let b = Box::new(1);
| -
@ -22,7 +22,7 @@ LL | b = Box::new(2);
| ^ cannot assign twice to immutable variable
error[E0384]: cannot assign to immutable argument `b`
--> $DIR/issue-45199.rs:22:5
--> $DIR/issue-45199.rs:20:5
|
LL | fn test_args(b: Box<i32>) {
| - help: consider making this binding mutable: `mut b`

View file

@ -1,7 +1,7 @@
// check-pass
// known-bug: #110395
// known-bug: #97156
#![feature(const_type_id, generic_const_exprs)]
#![feature(const_type_id, const_trait_impl, generic_const_exprs)]
#![allow(incomplete_features)]
use std::any::TypeId;
@ -26,7 +26,10 @@ impl<T: 'static> AssocCt for T {
trait WithAssoc<U> {
type Assoc;
}
impl<T: 'static> WithAssoc<()> for T where [(); <T as AssocCt>::ASSOC]: {
impl<T: 'static> WithAssoc<()> for T
where
[(); <T as AssocCt>::ASSOC]:,
{
type Assoc = [u8; <T as AssocCt>::ASSOC];
}
@ -38,7 +41,6 @@ where
x
}
fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc
where
One: WithAssoc<T>,

View file

@ -0,0 +1,11 @@
error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/typeid-equality-by-subtyping.rs:18:9
|
LL | WHAT_A_TYPE => 0,
| ^^^^^^^^^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: aborting due to previous error

View file

@ -4,8 +4,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
LL | std::mem::transmute(v)
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `[[u32; H+1]; W]` (generic size [const expr])
= note: target type: `[[u32; W+1]; H]` (generic size [const expr])
= note: source type: `[[u32; H+1]; W]` (generic size {const expr})
= note: target type: `[[u32; W+1]; H]` (generic size {const expr})
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute-fail.rs:16:5
@ -34,8 +34,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
LL | std::mem::transmute(v)
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `[[u32; H]; W]` (generic size [const expr])
= note: target type: `[u32; W * H * H]` (generic size [const expr])
= note: source type: `[[u32; H]; W]` (generic size {const expr})
= note: target type: `[u32; W * H * H]` (generic size {const expr})
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute-fail.rs:30:5

View file

@ -20,7 +20,6 @@ LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>());
note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
--> $DIR/const_cmp_type_id.rs:9:13
@ -44,7 +43,6 @@ LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>());
note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: can't compare `TypeId` with `TypeId` in const contexts
--> $DIR/const_cmp_type_id.rs:10:22

View file

@ -20,7 +20,6 @@ LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE
note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/any.rs:LL:COL
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors

View file

@ -7,5 +7,5 @@ fn main() {
let x = 0;
let y = &x as *const _;
let _ = y.is_null();
//~^ error: the type of this value must be known to call a method on a raw pointer on it [E0699]
//~^ error: cannot call a method on a raw pointer with an unknown pointee type [E0699]
}

View file

@ -1,4 +1,4 @@
error[E0699]: the type of this value must be known to call a method on a raw pointer on it
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
--> $DIR/edition-raw-pointer-method-2018.rs:9:15
|
LL | let _ = y.is_null();

View file

@ -6,6 +6,7 @@ mod parser {
pub use options::*;
// Private single import shadows public glob import, but arrives too late for initial
// resolution of `use parser::ParseOptions` because it depends on that resolution itself.
#[allow(hidden_glob_reexports)]
use ParseOptions;
}

View file

@ -1,16 +1,16 @@
error[E0603]: struct import `ParseOptions` is private
--> $DIR/issue-55884-2.rs:12:17
--> $DIR/issue-55884-2.rs:13:17
|
LL | pub use parser::ParseOptions;
| ^^^^^^^^^^^^ private struct import
|
note: the struct import `ParseOptions` is defined here...
--> $DIR/issue-55884-2.rs:9:9
--> $DIR/issue-55884-2.rs:10:9
|
LL | use ParseOptions;
| ^^^^^^^^^^^^
note: ...and refers to the struct import `ParseOptions` which is defined here...
--> $DIR/issue-55884-2.rs:12:9
--> $DIR/issue-55884-2.rs:13:9
|
LL | pub use parser::ParseOptions;
| ^^^^^^^^^^^^^^^^^^^^ consider importing it directly

View file

@ -5,7 +5,7 @@ LL | let a = &FOO;
| ^^^^ thread-local variables cannot be borrowed beyond the end of the function
...
LL | }
| - end of enclosing function is here
| - end of enclosing function is here
error: aborting due to previous error

View file

@ -2,12 +2,10 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-52049.rs:6:10
|
LL | foo(&unpromotable(5u32));
| -----^^^^^^^^^^^^^^^^^^-
| -----^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement
| | |
| | creates a temporary value which is freed while still in use
| argument requires that borrow lasts for `'static`
LL | }
| - temporary value is freed at the end of this statement
error: aborting due to previous error

View file

@ -10,7 +10,7 @@ LL | let read = &refcell as &RefCell<dyn Read>;
| -------- cast requires that `foo` is borrowed for `'static`
...
LL | }
| - `foo` dropped here while still borrowed
| - `foo` dropped here while still borrowed
error: lifetime may not live long enough
--> $DIR/issue-90600-expected-return-static-indirect.rs:9:16

View file

@ -0,0 +1,7 @@
// check-pass
// compile-flags: -Dunused_attributes
#![deny(unused_crate_dependencies)]
#![feature(lint_reasons)]
fn main() {}

View file

@ -5,7 +5,6 @@ fn test() {
drop(b);
b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
//~| NOTE cannot assign twice to immutable
//~| NOTE in this expansion of desugaring of drop and replace
drop(b);
}

View file

@ -5,7 +5,7 @@
// needs-unwind Asserting on contents of error message
#![allow(path_statements, unused_allocation)]
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
#![feature(core_intrinsics, generic_assert)]
macro_rules! test {
(
@ -51,6 +51,7 @@ macro_rules! tests {
const FOO: Foo = Foo { bar: 1 };
#[derive(Clone, Copy, Debug, PartialEq)]
struct Foo {
bar: i32
@ -83,9 +84,18 @@ fn main() {
// cast
[ elem as i32 == 3 ] => "Assertion failed: elem as i32 == 3\nWith captures:\n elem = 1\n"
// if
[ if elem == 3 { true } else { false } ] => "Assertion failed: if elem == 3 { true } else { false }\nWith captures:\n elem = 1\n"
// index
[ [1i32, 1][elem as usize] == 3 ] => "Assertion failed: [1i32, 1][elem as usize] == 3\nWith captures:\n elem = 1\n"
// let
[ if let 3 = elem { true } else { false } ] => "Assertion failed: if let 3 = elem { true } else { false }\nWith captures:\n elem = 1\n"
// match
[ match elem { 3 => true, _ => false, } ] => "Assertion failed: match elem { 3 => true, _ => false, }\nWith captures:\n elem = 1\n"
// method call
[ FOO.add(elem, elem) == 3 ] => "Assertion failed: FOO.add(elem, elem) == 3\nWith captures:\n elem = 1\n"
@ -107,77 +117,4 @@ fn main() {
// unary
[ -elem == -3 ] => "Assertion failed: -elem == -3\nWith captures:\n elem = 1\n"
);
// ***** Disallowed *****
tests!(
let mut elem = 1i32;
// assign
[ { let local = elem; local } == 3 ] => "Assertion failed: { let local = elem; local } == 3"
// assign op
[ { elem += 1; elem } == 3 ] => "Assertion failed: { elem += 1; elem } == 3"
// async
[ { let _ = async { elem }; elem } == 3 ] => "Assertion failed: { let _ = async { elem }; elem } == 3"
// await
// block
[ { elem } == 3 ] => "Assertion failed: { elem } == 3"
// break
[ loop { break elem; } == 3 ] => "Assertion failed: loop { break elem; } == 3"
// closure
[(|| elem)() == 3 ] => "Assertion failed: (|| elem)() == 3"
// const block
// continue
// err
// field
[ FOO.bar == 3 ] => "Assertion failed: FOO.bar == 3"
// for loop
[ { for _ in 0..elem { elem; } elem } == 3 ] => "Assertion failed: { for _ in 0..elem { elem; } elem } == 3"
// if
[ if true { elem } else { elem } == 3 ] => "Assertion failed: if true { elem } else { elem } == 3"
// inline asm
// let
[ if let true = true { elem } else { elem } == 3 ] => "Assertion failed: if let true = true { elem } else { elem } == 3"
// lit
// loop
[ loop { elem; break elem; } == 3 ] => "Assertion failed: loop { elem; break elem; } == 3"
// mac call
// match
[ match elem { _ => elem } == 3 ] => "Assertion failed: (match elem { _ => elem, }) == 3"
// ret
[ (|| { return elem; })() == 3 ] => "Assertion failed: (|| { return elem; })() == 3"
// try
[ (|| { Some(Some(elem)?) })() == Some(3) ] => "Assertion failed: (|| { Some(Some(elem)?) })() == Some(3)"
// try block
// underscore
// while
[ { while false { elem; break; } elem } == 3 ] => "Assertion failed: { while false { elem; break; } elem } == 3"
// yeet
// yield
);
}

View file

@ -4,7 +4,7 @@
// run-pass
// needs-unwind Asserting on contents of error message
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
#![feature(core_intrinsics, generic_assert)]
extern crate common;

View file

@ -1,7 +1,7 @@
// compile-flags: --test
// run-pass
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
#![feature(core_intrinsics, generic_assert)]
#[should_panic(expected = "Custom user message")]
#[test]

View file

@ -3,7 +3,7 @@
// run-pass
// needs-unwind Asserting on contents of error message
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
#![feature(core_intrinsics, generic_assert)]
extern crate common;

View file

@ -2,7 +2,7 @@
// ignore-tidy-linelength
// run-pass
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
#![feature(core_intrinsics, generic_assert)]
use std::fmt::{Debug, Formatter};

View file

@ -1,7 +1,7 @@
// check-pass
// compile-flags: -Z unpretty=expanded
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
#![feature(core_intrinsics, generic_assert)]
fn arbitrary_consuming_method_for_demonstration_purposes() {
let elem = 1i32;

View file

@ -3,7 +3,7 @@
// check-pass
// compile-flags: -Z unpretty=expanded
#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
#![feature(core_intrinsics, generic_assert)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]

View file

@ -0,0 +1,28 @@
// edition: 2018
// tests that the pointee type of a raw pointer must be known to call methods on it
// see also: `tests/ui/editions/edition-raw-pointer-method-2018.rs`
fn main() {
let val = 1_u32;
let ptr = &val as *const u32;
unsafe {
let _a: i32 = (ptr as *const _).read();
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
let b = ptr as *const _;
let _b: u8 = b.read();
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
let _c = (ptr as *const u8).read(); // we know the type here
}
let mut val = 2_u32;
let ptr = &mut val as *mut u32;
unsafe {
let _a: i32 = (ptr as *mut _).read();
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
let b = ptr as *mut _;
b.write(10);
//~^ ERROR cannot call a method on a raw pointer with an unknown pointee type [E0699]
(ptr as *mut i32).write(1000); // we know the type here
}
}

View file

@ -0,0 +1,27 @@
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
--> $DIR/call_method_unknown_pointee.rs:10:41
|
LL | let _a: i32 = (ptr as *const _).read();
| ^^^^
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
--> $DIR/call_method_unknown_pointee.rs:13:24
|
LL | let _b: u8 = b.read();
| ^^^^
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
--> $DIR/call_method_unknown_pointee.rs:21:39
|
LL | let _a: i32 = (ptr as *mut _).read();
| ^^^^
error[E0699]: cannot call a method on a raw pointer with an unknown pointee type
--> $DIR/call_method_unknown_pointee.rs:24:11
|
LL | b.write(10);
| ^^^^^
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0699`.

View file

@ -0,0 +1,15 @@
// run-pass
// ignore-wasm32-bare: No panic messages
// compile-flags: -C debug-assertions
struct Misalignment {
a: u32,
}
fn main() {
let items: [Misalignment; 2] = [Misalignment { a: 0 }, Misalignment { a: 1 }];
unsafe {
let ptr: *const Misalignment = items.as_ptr().cast::<u8>().add(1).cast::<Misalignment>();
let _ptr = core::ptr::addr_of!((*ptr).a);
}
}

View file

@ -22,7 +22,7 @@ LL | fn bar(&mut self) { }
| ^^^^^^^^^
| |
| types differ in mutability
| help: change the self-receiver type to match the trait: `self: &Bar`
| help: change the self-receiver type to match the trait: `&self`
|
note: type in trait
--> $DIR/E0053.rs:3:12

View file

@ -0,0 +1,7 @@
struct Foo;
impl Drop for Foo {
fn drop(self) {} //~ ERROR method `drop` has an incompatible type for trait
}
fn main() {}

View file

@ -0,0 +1,15 @@
error[E0053]: method `drop` has an incompatible type for trait
--> $DIR/issue-112036.rs:4:13
|
LL | fn drop(self) {}
| ^^^^
| |
| expected `&mut Foo`, found `Foo`
| help: change the self-receiver type to match the trait: `&mut self`
|
= note: expected signature `fn(&mut Foo)`
found signature `fn(Foo)`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0053`.

View file

@ -0,0 +1,24 @@
// run-pass
// needs-unwind
// Checks that nested panics work correctly.
use std::panic::catch_unwind;
fn double() {
struct Double;
impl Drop for Double {
fn drop(&mut self) {
let _ = catch_unwind(|| panic!("twice"));
}
}
let _d = Double;
panic!("once");
}
fn main() {
assert!(catch_unwind(|| double()).is_err());
}

View file

@ -0,0 +1,2 @@
fn a<<i<Y<w<>#
//~^ ERROR expected one of `#`, `>`, `const`, identifier, or lifetime, found `<`

View file

@ -0,0 +1,8 @@
error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<`
--> $DIR/issue-111148.rs:1:6
|
LL | fn a<<i<Y<w<>#
| ^ expected one of `#`, `>`, `const`, identifier, or lifetime
error: aborting due to previous error

View file

@ -0,0 +1,33 @@
mod b {
pub struct A(u32);
}
trait Id {
type Assoc;
}
impl Id for b::A {
type Assoc = b::A;
}
impl Id for u32 {
type Assoc = u32;
}
trait Trait<T> {
fn method(&self)
where
T: Id<Assoc = b::A>;
}
impl<T: Id> Trait<T> for <T as Id>::Assoc {
fn method(&self)
where
T: Id<Assoc = b::A>,
{
let Self(a) = self;
//~^ ERROR: tuple struct constructor `A` is private
println!("{a}");
}
}
fn main() {}

View file

@ -0,0 +1,9 @@
error[E0603]: tuple struct constructor `A` is private
--> $DIR/issue-111220-2-tuple-struct-fields-projection.rs:27:13
|
LL | let Self(a) = self;
| ^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0603`.

View file

@ -0,0 +1,46 @@
mod b {
#[derive(Default)]
pub struct A(u32);
}
impl b::A {
fn inherent_bypass(&self) {
let Self(x) = self;
//~^ ERROR: tuple struct constructor `A` is private
println!("{x}");
}
}
pub trait B {
fn f(&self);
}
impl B for b::A {
fn f(&self) {
let Self(a) = self;
//~^ ERROR: tuple struct constructor `A` is private
println!("{}", a);
}
}
pub trait Projector {
type P;
}
impl Projector for () {
type P = b::A;
}
pub trait Bypass2 {
fn f2(&self);
}
impl Bypass2 for <() as Projector>::P {
fn f2(&self) {
let Self(a) = self;
//~^ ERROR: tuple struct constructor `A` is private
println!("{}", a);
}
}
fn main() {}

View file

@ -0,0 +1,21 @@
error[E0603]: tuple struct constructor `A` is private
--> $DIR/issue-111220-tuple-struct-fields.rs:8:13
|
LL | let Self(x) = self;
| ^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/issue-111220-tuple-struct-fields.rs:20:13
|
LL | let Self(a) = self;
| ^^^^^^^
error[E0603]: tuple struct constructor `A` is private
--> $DIR/issue-111220-tuple-struct-fields.rs:40:13
|
LL | let Self(a) = self;
| ^^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0603`.

View file

@ -0,0 +1,52 @@
// check-pass
pub mod upstream_a {
mod inner {
pub struct Foo {}
pub struct Bar {}
}
pub use self::inner::*;
struct Foo;
//~^ WARN private item shadows public glob re-export
}
pub mod upstream_b {
mod inner {
pub struct Foo {}
pub struct Qux {}
}
mod other {
pub struct Foo;
}
pub use self::inner::*;
use self::other::Foo;
//~^ WARN private item shadows public glob re-export
}
pub mod upstream_c {
mod no_def_id {
#![allow(non_camel_case_types)]
pub struct u8;
pub struct World;
}
pub use self::no_def_id::*;
use std::primitive::u8;
//~^ WARN private item shadows public glob re-export
}
// Downstream crate
// mod downstream {
// fn proof() {
// let _ = crate::upstream_a::Foo;
// let _ = crate::upstream_b::Foo;
// }
// }
pub fn main() {}

View file

@ -0,0 +1,31 @@
warning: private item shadows public glob re-export
--> $DIR/hidden_glob_reexports.rs:11:5
|
LL | pub use self::inner::*;
| -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here
LL |
LL | struct Foo;
| ^^^^^^^^^^^ but the private item here shadows it
|
= note: `#[warn(hidden_glob_reexports)]` on by default
warning: private item shadows public glob re-export
--> $DIR/hidden_glob_reexports.rs:27:9
|
LL | pub use self::inner::*;
| -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here
LL |
LL | use self::other::Foo;
| ^^^^^^^^^^^^^^^^ but the private item here shadows it
warning: private item shadows public glob re-export
--> $DIR/hidden_glob_reexports.rs:40:9
|
LL | pub use self::no_def_id::*;
| ------------------ the name `u8` in the type namespace is supposed to be publicly re-exported here
LL |
LL | use std::primitive::u8;
| ^^^^^^^^^^^^^^^^^^ but the private item here shadows it
warning: 3 warnings emitted

View file

@ -2,7 +2,7 @@
trait One<A> { fn foo(&self) -> A; }
fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One<()>`
fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One`
{}
fn main() { }

View file

@ -1,4 +1,4 @@
error[E0220]: associated type `Output` not found for `One<()>`
error[E0220]: associated type `Output` not found for `One`
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:16
|
LL | fn foo(_: &dyn One())

View file

@ -12,7 +12,7 @@ note: trait defined here, with 3 generic parameters: `A`, `B`, `C`
LL | trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); }
| ^^^^^ - - -
error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>`
error[E0220]: associated type `Output` not found for `Three`
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
|
LL | fn foo(_: &dyn Three())