summaryrefslogtreecommitdiffstats
path: root/tests/ui/save-analysis
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/save-analysis
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/save-analysis')
-rw-r--r--tests/ui/save-analysis/emit-notifications.polonius.stderr2
-rw-r--r--tests/ui/save-analysis/emit-notifications.rs7
-rw-r--r--tests/ui/save-analysis/emit-notifications.stderr2
-rw-r--r--tests/ui/save-analysis/issue-26459.rs8
-rw-r--r--tests/ui/save-analysis/issue-26459.stderr9
-rw-r--r--tests/ui/save-analysis/issue-37323.rs20
-rw-r--r--tests/ui/save-analysis/issue-59134-0.rs12
-rw-r--r--tests/ui/save-analysis/issue-59134-0.stderr9
-rw-r--r--tests/ui/save-analysis/issue-59134-1.rs12
-rw-r--r--tests/ui/save-analysis/issue-59134-1.stderr9
-rw-r--r--tests/ui/save-analysis/issue-63663.rs28
-rw-r--r--tests/ui/save-analysis/issue-64659.rs10
-rw-r--r--tests/ui/save-analysis/issue-65411.rs15
-rw-r--r--tests/ui/save-analysis/issue-65590.rs21
-rw-r--r--tests/ui/save-analysis/issue-68621.rs17
-rw-r--r--tests/ui/save-analysis/issue-68621.stderr10
-rw-r--r--tests/ui/save-analysis/issue-72267.rs7
-rw-r--r--tests/ui/save-analysis/issue-72267.stderr15
-rw-r--r--tests/ui/save-analysis/issue-73020.rs5
-rw-r--r--tests/ui/save-analysis/issue-73020.stderr9
-rw-r--r--tests/ui/save-analysis/issue-73022.rs13
-rw-r--r--tests/ui/save-analysis/issue-89066.rs28
-rw-r--r--tests/ui/save-analysis/issue-89066.stderr39
23 files changed, 307 insertions, 0 deletions
diff --git a/tests/ui/save-analysis/emit-notifications.polonius.stderr b/tests/ui/save-analysis/emit-notifications.polonius.stderr
new file mode 100644
index 000000000..a1a1b8c63
--- /dev/null
+++ b/tests/ui/save-analysis/emit-notifications.polonius.stderr
@@ -0,0 +1,2 @@
+{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications.polonius/save-analysis/libemit_notifications.json","emit":"save-analysis"}
+{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications.polonius/libemit_notifications.rlib","emit":"link"}
diff --git a/tests/ui/save-analysis/emit-notifications.rs b/tests/ui/save-analysis/emit-notifications.rs
new file mode 100644
index 000000000..9179944a6
--- /dev/null
+++ b/tests/ui/save-analysis/emit-notifications.rs
@@ -0,0 +1,7 @@
+// build-pass (FIXME(62277): could be check-pass?)
+// compile-flags: -Zsave-analysis --json artifacts
+// compile-flags: --crate-type rlib --error-format=json
+// ignore-pass
+// ^-- needed because otherwise, the .stderr file changes with --pass check
+
+pub fn foo() {}
diff --git a/tests/ui/save-analysis/emit-notifications.stderr b/tests/ui/save-analysis/emit-notifications.stderr
new file mode 100644
index 000000000..e16f60f8b
--- /dev/null
+++ b/tests/ui/save-analysis/emit-notifications.stderr
@@ -0,0 +1,2 @@
+{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications/save-analysis/libemit_notifications.json","emit":"save-analysis"}
+{"artifact":"$TEST_BUILD_DIR/save-analysis/emit-notifications/libemit_notifications.rlib","emit":"link"}
diff --git a/tests/ui/save-analysis/issue-26459.rs b/tests/ui/save-analysis/issue-26459.rs
new file mode 100644
index 000000000..2ba05a0a4
--- /dev/null
+++ b/tests/ui/save-analysis/issue-26459.rs
@@ -0,0 +1,8 @@
+// compile-flags: -Zsave-analysis
+
+fn main() {
+ match 'a' {
+ char{ch} => true
+ //~^ ERROR expected struct, variant or union type, found builtin type `char`
+ };
+}
diff --git a/tests/ui/save-analysis/issue-26459.stderr b/tests/ui/save-analysis/issue-26459.stderr
new file mode 100644
index 000000000..9f594990c
--- /dev/null
+++ b/tests/ui/save-analysis/issue-26459.stderr
@@ -0,0 +1,9 @@
+error[E0574]: expected struct, variant or union type, found builtin type `char`
+ --> $DIR/issue-26459.rs:5:9
+ |
+LL | char{ch} => true
+ | ^^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
diff --git a/tests/ui/save-analysis/issue-37323.rs b/tests/ui/save-analysis/issue-37323.rs
new file mode 100644
index 000000000..55f5c5a95
--- /dev/null
+++ b/tests/ui/save-analysis/issue-37323.rs
@@ -0,0 +1,20 @@
+// check-pass
+// compile-flags: -Zsave-analysis
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+#[derive(Debug)]
+struct Point {
+}
+
+struct NestedA<'a, 'b> {
+ x: &'a NestedB<'b>
+}
+
+struct NestedB<'a> {
+ x: &'a i32,
+}
+
+fn main() {
+}
diff --git a/tests/ui/save-analysis/issue-59134-0.rs b/tests/ui/save-analysis/issue-59134-0.rs
new file mode 100644
index 000000000..a0871ca18
--- /dev/null
+++ b/tests/ui/save-analysis/issue-59134-0.rs
@@ -0,0 +1,12 @@
+// compile-flags: -Zsave-analysis
+
+// Check that this doesn't ICE when processing associated const (field expr).
+
+pub fn f() {
+ trait Trait {}
+ impl dyn Trait {
+ const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus`
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/save-analysis/issue-59134-0.stderr b/tests/ui/save-analysis/issue-59134-0.stderr
new file mode 100644
index 000000000..4e9b2e6fd
--- /dev/null
+++ b/tests/ui/save-analysis/issue-59134-0.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `bogus` in this scope
+ --> $DIR/issue-59134-0.rs:8:27
+ |
+LL | const FLAG: u32 = bogus.field;
+ | ^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/save-analysis/issue-59134-1.rs b/tests/ui/save-analysis/issue-59134-1.rs
new file mode 100644
index 000000000..3cb629777
--- /dev/null
+++ b/tests/ui/save-analysis/issue-59134-1.rs
@@ -0,0 +1,12 @@
+// compile-flags: -Zsave-analysis
+
+// Check that this doesn't ICE when processing associated const (type).
+
+fn func() {
+ trait Trait {
+ type MyType;
+ const CONST: Self::MyType = bogus.field; //~ ERROR cannot find value `bogus`
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/save-analysis/issue-59134-1.stderr b/tests/ui/save-analysis/issue-59134-1.stderr
new file mode 100644
index 000000000..bdc335eaa
--- /dev/null
+++ b/tests/ui/save-analysis/issue-59134-1.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `bogus` in this scope
+ --> $DIR/issue-59134-1.rs:8:37
+ |
+LL | const CONST: Self::MyType = bogus.field;
+ | ^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/save-analysis/issue-63663.rs b/tests/ui/save-analysis/issue-63663.rs
new file mode 100644
index 000000000..92e85884f
--- /dev/null
+++ b/tests/ui/save-analysis/issue-63663.rs
@@ -0,0 +1,28 @@
+// check-pass
+// compile-flags: -Zsave-analysis
+
+pub trait Trait {
+ type Assoc;
+}
+
+pub struct A;
+
+trait Generic<T> {}
+impl<T> Generic<T> for () {}
+
+// Don't ICE when resolving type paths in return type `impl Trait`
+fn assoc_in_opaque_type_bounds<U: Trait>() -> impl Generic<U::Assoc> {}
+
+// Check that this doesn't ICE when processing associated const in formal
+// argument and return type of functions defined inside function/method scope.
+pub fn func() {
+ fn _inner1<U: Trait>(_: U::Assoc) {}
+ fn _inner2<U: Trait>() -> U::Assoc { unimplemented!() }
+
+ impl A {
+ fn _inner1<U: Trait>(self, _: U::Assoc) {}
+ fn _inner2<U: Trait>(self) -> U::Assoc { unimplemented!() }
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/save-analysis/issue-64659.rs b/tests/ui/save-analysis/issue-64659.rs
new file mode 100644
index 000000000..a3d88a203
--- /dev/null
+++ b/tests/ui/save-analysis/issue-64659.rs
@@ -0,0 +1,10 @@
+// check-pass
+// compile-flags: -Zsave-analysis
+
+trait Trait { type Assoc; }
+
+fn main() {
+ struct Data<T: Trait> {
+ x: T::Assoc,
+ }
+}
diff --git a/tests/ui/save-analysis/issue-65411.rs b/tests/ui/save-analysis/issue-65411.rs
new file mode 100644
index 000000000..9e58b8da5
--- /dev/null
+++ b/tests/ui/save-analysis/issue-65411.rs
@@ -0,0 +1,15 @@
+// check-pass
+// compile-flags: -Zsave-analysis
+
+trait Trait { type Assoc; }
+trait GenericTrait<T> {}
+struct Wrapper<B> { b: B }
+
+fn func() {
+ // Processing associated path in impl block definition inside a function
+ // body does not ICE
+ impl<B: Trait> GenericTrait<B::Assoc> for Wrapper<B> {}
+}
+
+
+fn main() {}
diff --git a/tests/ui/save-analysis/issue-65590.rs b/tests/ui/save-analysis/issue-65590.rs
new file mode 100644
index 000000000..27874f865
--- /dev/null
+++ b/tests/ui/save-analysis/issue-65590.rs
@@ -0,0 +1,21 @@
+// check-pass
+// compile-flags: -Zsave-analysis
+// edition:2018
+
+// Async desugaring for return types in (associated) functions introduces a
+// separate definition internally, which we need to take into account
+// (or else we ICE).
+trait Trait { type Assoc; }
+struct Struct;
+
+async fn foobar<T: Trait>() -> T::Assoc {
+ unimplemented!()
+}
+
+impl Struct {
+ async fn foo<T: Trait>(&self) -> T::Assoc {
+ unimplemented!()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/save-analysis/issue-68621.rs b/tests/ui/save-analysis/issue-68621.rs
new file mode 100644
index 000000000..30479580f
--- /dev/null
+++ b/tests/ui/save-analysis/issue-68621.rs
@@ -0,0 +1,17 @@
+// compile-flags: -Zsave-analysis
+
+#![feature(type_alias_impl_trait)]
+
+trait Trait {}
+
+trait Service {
+ type Future: Trait;
+}
+
+struct Struct;
+
+impl Service for Struct {
+ type Future = impl Trait; //~ ERROR: unconstrained opaque type
+}
+
+fn main() {}
diff --git a/tests/ui/save-analysis/issue-68621.stderr b/tests/ui/save-analysis/issue-68621.stderr
new file mode 100644
index 000000000..4452ee791
--- /dev/null
+++ b/tests/ui/save-analysis/issue-68621.stderr
@@ -0,0 +1,10 @@
+error: unconstrained opaque type
+ --> $DIR/issue-68621.rs:14:19
+ |
+LL | type Future = impl Trait;
+ | ^^^^^^^^^^
+ |
+ = note: `Future` must be used in combination with a concrete type within the same impl
+
+error: aborting due to previous error
+
diff --git a/tests/ui/save-analysis/issue-72267.rs b/tests/ui/save-analysis/issue-72267.rs
new file mode 100644
index 000000000..eea0a7fea
--- /dev/null
+++ b/tests/ui/save-analysis/issue-72267.rs
@@ -0,0 +1,7 @@
+// compile-flags: -Z save-analysis
+
+fn main() {
+ let _: Box<(dyn ?Sized)>;
+ //~^ ERROR `?Trait` is not permitted in trait object types
+ //~| ERROR at least one trait is required for an object type
+}
diff --git a/tests/ui/save-analysis/issue-72267.stderr b/tests/ui/save-analysis/issue-72267.stderr
new file mode 100644
index 000000000..76fc6c57c
--- /dev/null
+++ b/tests/ui/save-analysis/issue-72267.stderr
@@ -0,0 +1,15 @@
+error: `?Trait` is not permitted in trait object types
+ --> $DIR/issue-72267.rs:4:21
+ |
+LL | let _: Box<(dyn ?Sized)>;
+ | ^^^^^^
+
+error[E0224]: at least one trait is required for an object type
+ --> $DIR/issue-72267.rs:4:17
+ |
+LL | let _: Box<(dyn ?Sized)>;
+ | ^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0224`.
diff --git a/tests/ui/save-analysis/issue-73020.rs b/tests/ui/save-analysis/issue-73020.rs
new file mode 100644
index 000000000..87ce09336
--- /dev/null
+++ b/tests/ui/save-analysis/issue-73020.rs
@@ -0,0 +1,5 @@
+// compile-flags: -Zsave-analysis
+use {self}; //~ ERROR E0431
+
+fn main () {
+}
diff --git a/tests/ui/save-analysis/issue-73020.stderr b/tests/ui/save-analysis/issue-73020.stderr
new file mode 100644
index 000000000..5bb3aae99
--- /dev/null
+++ b/tests/ui/save-analysis/issue-73020.stderr
@@ -0,0 +1,9 @@
+error[E0431]: `self` import can only appear in an import list with a non-empty prefix
+ --> $DIR/issue-73020.rs:2:6
+ |
+LL | use {self};
+ | ^^^^ can only appear in an import list with a non-empty prefix
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0431`.
diff --git a/tests/ui/save-analysis/issue-73022.rs b/tests/ui/save-analysis/issue-73022.rs
new file mode 100644
index 000000000..9ad89a319
--- /dev/null
+++ b/tests/ui/save-analysis/issue-73022.rs
@@ -0,0 +1,13 @@
+// build-pass
+// compile-flags: -Zsave-analysis
+enum Enum2 {
+ Variant8 { _field: bool },
+}
+
+impl Enum2 {
+ fn new_variant8() -> Enum2 {
+ Self::Variant8 { _field: true }
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/save-analysis/issue-89066.rs b/tests/ui/save-analysis/issue-89066.rs
new file mode 100644
index 000000000..c65e2d73f
--- /dev/null
+++ b/tests/ui/save-analysis/issue-89066.rs
@@ -0,0 +1,28 @@
+// compile-flags: -Zsave-analysis
+
+// Check that this does not ICE.
+// Stolen from tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
+
+#![feature(generic_arg_infer)]
+
+struct All<'a, T, const N: usize> {
+ v: &'a T,
+}
+
+struct BadInfer<_>;
+//~^ ERROR expected identifier
+//~| ERROR parameter `_` is never used
+
+fn all_fn<'a, T, const N: usize>() {}
+
+fn bad_infer_fn<_>() {}
+//~^ ERROR expected identifier
+
+
+fn main() {
+ let a: All<_, _, _>;
+ //~^ ERROR this struct takes 2 generic arguments but 3 generic arguments were supplied
+ all_fn();
+ let v: [u8; _];
+ let v: [u8; 10] = [0; _];
+}
diff --git a/tests/ui/save-analysis/issue-89066.stderr b/tests/ui/save-analysis/issue-89066.stderr
new file mode 100644
index 000000000..5ef04936e
--- /dev/null
+++ b/tests/ui/save-analysis/issue-89066.stderr
@@ -0,0 +1,39 @@
+error: expected identifier, found reserved identifier `_`
+ --> $DIR/issue-89066.rs:12:17
+ |
+LL | struct BadInfer<_>;
+ | ^ expected identifier, found reserved identifier
+
+error: expected identifier, found reserved identifier `_`
+ --> $DIR/issue-89066.rs:18:17
+ |
+LL | fn bad_infer_fn<_>() {}
+ | ^ expected identifier, found reserved identifier
+
+error[E0392]: parameter `_` is never used
+ --> $DIR/issue-89066.rs:12:17
+ |
+LL | struct BadInfer<_>;
+ | ^ unused parameter
+ |
+ = help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData`
+ = help: if you intended `_` to be a const parameter, use `const _: usize` instead
+
+error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
+ --> $DIR/issue-89066.rs:23:10
+ |
+LL | let a: All<_, _, _>;
+ | ^^^ - help: remove this generic argument
+ | |
+ | expected 2 generic arguments
+ |
+note: struct defined here, with 2 generic parameters: `T`, `N`
+ --> $DIR/issue-89066.rs:8:8
+ |
+LL | struct All<'a, T, const N: usize> {
+ | ^^^ - --------------
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0107, E0392.
+For more information about an error, try `rustc --explain E0107`.