diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
commit | 5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch) | |
tree | 35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /src/test/ui/typeck | |
parent | Adding debian version 1.66.0+dfsg1-1. (diff) | |
download | rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip |
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/typeck')
-rw-r--r-- | src/test/ui/typeck/issue-103899.rs | 30 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-104510-ice.rs | 16 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-104510-ice.stderr | 9 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-104513-ice.rs | 6 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-104513-ice.stderr | 18 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-10969.rs | 7 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-10969.stderr | 23 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-50687-ice-on-borrow.rs | 41 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-50687-ice-on-borrow.stderr | 18 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-81293.stderr | 13 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-83693.stderr | 4 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-91267.rs | 4 | ||||
-rw-r--r-- | src/test/ui/typeck/issue-91267.stderr | 21 | ||||
-rw-r--r-- | src/test/ui/typeck/path-to-method-sugg-unresolved-expr.rs | 4 | ||||
-rw-r--r-- | src/test/ui/typeck/path-to-method-sugg-unresolved-expr.stderr | 9 |
15 files changed, 199 insertions, 24 deletions
diff --git a/src/test/ui/typeck/issue-103899.rs b/src/test/ui/typeck/issue-103899.rs new file mode 100644 index 000000000..ac9e4c716 --- /dev/null +++ b/src/test/ui/typeck/issue-103899.rs @@ -0,0 +1,30 @@ +// check-fail +// failure-status: 101 +// dont-check-compiler-stderr +// known-bug: #103899 + +trait BaseWithAssoc { + type Assoc; +} + +trait WrapperWithAssoc { + type BaseAssoc: BaseWithAssoc; +} + +struct Wrapper<B> { + inner: B, +} + +struct ProjectToBase<T: BaseWithAssoc> { + data_type_h: T::Assoc, +} + +struct DoubleProject<L: WrapperWithAssoc> { + buffer: Wrapper<ProjectToBase<L::BaseAssoc>>, +} + +fn trigger<L: WrapperWithAssoc<BaseAssoc = ()>>() -> DoubleProject<L> { + loop {} +} + +fn main() {} diff --git a/src/test/ui/typeck/issue-104510-ice.rs b/src/test/ui/typeck/issue-104510-ice.rs new file mode 100644 index 000000000..157bdf07e --- /dev/null +++ b/src/test/ui/typeck/issue-104510-ice.rs @@ -0,0 +1,16 @@ +// needs-asm-support +// only-x86_64 + +struct W<T: ?Sized>(Oops); +//~^ ERROR cannot find type `Oops` in this scope + +unsafe fn test() { + let j = W(()); + let pointer = &j as *const _; + core::arch::asm!( + "nop", + in("eax") pointer, + ); +} + +fn main() {} diff --git a/src/test/ui/typeck/issue-104510-ice.stderr b/src/test/ui/typeck/issue-104510-ice.stderr new file mode 100644 index 000000000..ddb510ef0 --- /dev/null +++ b/src/test/ui/typeck/issue-104510-ice.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Oops` in this scope + --> $DIR/issue-104510-ice.rs:4:21 + | +LL | struct W<T: ?Sized>(Oops); + | ^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/typeck/issue-104513-ice.rs b/src/test/ui/typeck/issue-104513-ice.rs new file mode 100644 index 000000000..bcac0fa1e --- /dev/null +++ b/src/test/ui/typeck/issue-104513-ice.rs @@ -0,0 +1,6 @@ +struct S; +fn f() { + let _: S<impl Oops> = S; //~ ERROR cannot find trait `Oops` in this scope + //~^ ERROR `impl Trait` only allowed in function and inherent method return types +} +fn main() {} diff --git a/src/test/ui/typeck/issue-104513-ice.stderr b/src/test/ui/typeck/issue-104513-ice.stderr new file mode 100644 index 000000000..2b3b1b9ef --- /dev/null +++ b/src/test/ui/typeck/issue-104513-ice.stderr @@ -0,0 +1,18 @@ +error[E0405]: cannot find trait `Oops` in this scope + --> $DIR/issue-104513-ice.rs:3:19 + | +LL | fn f() { + | - help: you might be missing a type parameter: `<Oops>` +LL | let _: S<impl Oops> = S; + | ^^^^ not found in this scope + +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding + --> $DIR/issue-104513-ice.rs:3:14 + | +LL | let _: S<impl Oops> = S; + | ^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0405, E0562. +For more information about an error, try `rustc --explain E0405`. diff --git a/src/test/ui/typeck/issue-10969.rs b/src/test/ui/typeck/issue-10969.rs new file mode 100644 index 000000000..0b78fc1bb --- /dev/null +++ b/src/test/ui/typeck/issue-10969.rs @@ -0,0 +1,7 @@ +fn func(i: i32) { + i(); //~ERROR expected function, found `i32` +} +fn main() { + let i = 0i32; + i(); //~ERROR expected function, found `i32` +} diff --git a/src/test/ui/typeck/issue-10969.stderr b/src/test/ui/typeck/issue-10969.stderr new file mode 100644 index 000000000..f64b61aae --- /dev/null +++ b/src/test/ui/typeck/issue-10969.stderr @@ -0,0 +1,23 @@ +error[E0618]: expected function, found `i32` + --> $DIR/issue-10969.rs:2:5 + | +LL | fn func(i: i32) { + | - `i` has type `i32` +LL | i(); + | ^-- + | | + | call expression requires function + +error[E0618]: expected function, found `i32` + --> $DIR/issue-10969.rs:6:5 + | +LL | let i = 0i32; + | - `i` has type `i32` +LL | i(); + | ^-- + | | + | call expression requires function + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0618`. diff --git a/src/test/ui/typeck/issue-50687-ice-on-borrow.rs b/src/test/ui/typeck/issue-50687-ice-on-borrow.rs new file mode 100644 index 000000000..7a8a12c2a --- /dev/null +++ b/src/test/ui/typeck/issue-50687-ice-on-borrow.rs @@ -0,0 +1,41 @@ +// This previously caused an ICE at: +// librustc/traits/structural_impls.rs:180: impossible case reached + +#![no_main] + +use std::borrow::Borrow; +use std::io; +use std::io::Write; + +trait Constraint {} + +struct Container<T> { + t: T, +} + +struct Borrowed; +struct Owned; + +impl<'a, T> Write for &'a Container<T> +where + T: Constraint, + &'a T: Write, +{ + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + Ok(buf.len()) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl Borrow<Borrowed> for Owned { + fn borrow(&self) -> &Borrowed { + &Borrowed + } +} + +fn func(owned: Owned) { + let _: () = Borrow::borrow(&owned); //~ ERROR mismatched types +} diff --git a/src/test/ui/typeck/issue-50687-ice-on-borrow.stderr b/src/test/ui/typeck/issue-50687-ice-on-borrow.stderr new file mode 100644 index 000000000..e6a0edac4 --- /dev/null +++ b/src/test/ui/typeck/issue-50687-ice-on-borrow.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/issue-50687-ice-on-borrow.rs:40:17 + | +LL | let _: () = Borrow::borrow(&owned); + | -- ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found reference + | | + | expected due to this + | + = note: expected unit type `()` + found reference `&_` +help: consider dereferencing the borrow + | +LL | let _: () = *Borrow::borrow(&owned); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/issue-81293.stderr b/src/test/ui/typeck/issue-81293.stderr index 9658288ac..6976be711 100644 --- a/src/test/ui/typeck/issue-81293.stderr +++ b/src/test/ui/typeck/issue-81293.stderr @@ -21,15 +21,10 @@ LL | a = c + b * 5; | = help: the trait `Add<u16>` is not implemented for `usize` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&'a usize as Add<usize>> + <&usize as Add<&usize>> + <usize as Add<&usize>> + <usize as Add> error: aborting due to 3 previous errors diff --git a/src/test/ui/typeck/issue-83693.stderr b/src/test/ui/typeck/issue-83693.stderr index 0d8bbf1ce..1e45c2d35 100644 --- a/src/test/ui/typeck/issue-83693.stderr +++ b/src/test/ui/typeck/issue-83693.stderr @@ -6,8 +6,8 @@ LL | impl F { | ::: $SRC_DIR/core/src/ops/function.rs:LL:COL | -LL | pub trait Fn<Args>: FnMut<Args> { - | ------------------------------- similarly named trait `Fn` defined here +LL | pub trait Fn<Args: Tuple>: FnMut<Args> { + | -------------------------------------- similarly named trait `Fn` defined here error[E0412]: cannot find type `TestResult` in this scope --> $DIR/issue-83693.rs:9:22 diff --git a/src/test/ui/typeck/issue-91267.rs b/src/test/ui/typeck/issue-91267.rs index f5a37e9cb..4e39cfab5 100644 --- a/src/test/ui/typeck/issue-91267.rs +++ b/src/test/ui/typeck/issue-91267.rs @@ -1,5 +1,7 @@ +#![feature(type_ascription)] + fn main() { - 0: u8<e<5>=e> + type_ascribe!(0, u8<e<5>=e>) //~^ ERROR: cannot find type `e` in this scope [E0412] //~| ERROR: associated type bindings are not allowed here [E0229] //~| ERROR: mismatched types [E0308] diff --git a/src/test/ui/typeck/issue-91267.stderr b/src/test/ui/typeck/issue-91267.stderr index aac00b9b6..72acd9c67 100644 --- a/src/test/ui/typeck/issue-91267.stderr +++ b/src/test/ui/typeck/issue-91267.stderr @@ -1,25 +1,22 @@ error[E0412]: cannot find type `e` in this scope - --> $DIR/issue-91267.rs:2:16 + --> $DIR/issue-91267.rs:4:30 | -LL | 0: u8<e<5>=e> - | ^ - | | - | not found in this scope - | help: maybe you meant to write an assignment here: `let e` +LL | type_ascribe!(0, u8<e<5>=e>) + | ^ not found in this scope error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-91267.rs:2:11 + --> $DIR/issue-91267.rs:4:25 | -LL | 0: u8<e<5>=e> - | ^^^^^^ associated type not allowed here +LL | type_ascribe!(0, u8<e<5>=e>) + | ^^^^^^ associated type not allowed here error[E0308]: mismatched types - --> $DIR/issue-91267.rs:2:5 + --> $DIR/issue-91267.rs:4:5 | LL | fn main() { | - expected `()` because of default return type -LL | 0: u8<e<5>=e> - | ^^^^^^^^^^^^^ expected `()`, found `u8` +LL | type_ascribe!(0, u8<e<5>=e>) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `u8` error: aborting due to 3 previous errors diff --git a/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.rs b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.rs new file mode 100644 index 000000000..fb56b3944 --- /dev/null +++ b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.rs @@ -0,0 +1,4 @@ +fn main() { + let page_size = page_size::get(); + //~^ ERROR failed to resolve: use of undeclared crate or module `page_size` +} diff --git a/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.stderr b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.stderr new file mode 100644 index 000000000..b01e30be5 --- /dev/null +++ b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `page_size` + --> $DIR/path-to-method-sugg-unresolved-expr.rs:2:21 + | +LL | let page_size = page_size::get(); + | ^^^^^^^^^ use of undeclared crate or module `page_size` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. |