diff options
| author | bors <bors@rust-lang.org> | 2023-08-02 04:30:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-02 04:30:51 +0000 |
| commit | 7a5d2d0138d4a3d7d97cad0ca72ab62e938e0b0b (patch) | |
| tree | 662f74dd3bc2dec57c65dcdcabe8b716410eca3f /tests | |
| parent | 90bb4184f89a24d26787a9eada781bf3c4dd3dc6 (diff) | |
| parent | 4876afba38cb645da498d35ad0a3be2452f6f6af (diff) | |
| download | rust-7a5d2d0138d4a3d7d97cad0ca72ab62e938e0b0b.tar.gz rust-7a5d2d0138d4a3d7d97cad0ca72ab62e938e0b0b.zip | |
Auto merge of #114358 - matthiaskrgr:rollup-d810m9e, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #114178 (Account for macros when suggesting a new let binding) - #114199 (Don't unsize coerce infer vars in select in new solver) - #114301 (Don't check unnecessarily that impl trait is RPIT) - #114314 (Tweaks to `adt_sized_constraint`) - #114322 (Fix invalid slice coercion suggestion reported in turbofish) - #114340 ([rustc_attr][nit] Replace `filter` + `is_some` with `map_or`.) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
9 files changed, 112 insertions, 4 deletions
diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr index 4eeec09b910..6e112e27030 100644 --- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr +++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr @@ -8,8 +8,12 @@ LL | let x = defer(&vec!["Goodbye", "world!"]); LL | x.x[0]; | ------ borrow later used here | - = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using a `let` binding to create a longer lived value + | +LL ~ let binding = vec!["Goodbye", "world!"]; +LL ~ let x = defer(&binding); + | error: aborting due to previous error diff --git a/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.rs b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.rs new file mode 100644 index 00000000000..c6ef8379f45 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.rs @@ -0,0 +1,13 @@ +trait Test {} +impl Test for &[u8] {} + +fn needs_test<T: Test>() -> T { + panic!() +} + +fn main() { + needs_test::<[u8; 1]>(); + //~^ ERROR the trait bound + let x: [u8; 1] = needs_test(); + //~^ ERROR the trait bound +} diff --git a/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.stderr b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.stderr new file mode 100644 index 00000000000..6752a484448 --- /dev/null +++ b/tests/ui/dst/issue-90528-unsizing-not-suggestion-110063.stderr @@ -0,0 +1,29 @@ +error[E0277]: the trait bound `[u8; 1]: Test` is not satisfied + --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:9:18 + | +LL | needs_test::<[u8; 1]>(); + | ^^^^^^^ the trait `Test` is not implemented for `[u8; 1]` + | + = help: the trait `Test` is implemented for `&[u8]` +note: required by a bound in `needs_test` + --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:4:18 + | +LL | fn needs_test<T: Test>() -> T { + | ^^^^ required by this bound in `needs_test` + +error[E0277]: the trait bound `[u8; 1]: Test` is not satisfied + --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:11:22 + | +LL | let x: [u8; 1] = needs_test(); + | ^^^^^^^^^^ the trait `Test` is not implemented for `[u8; 1]` + | + = help: the trait `Test` is implemented for `&[u8]` +note: required by a bound in `needs_test` + --> $DIR/issue-90528-unsizing-not-suggestion-110063.rs:4:18 + | +LL | fn needs_test<T: Test>() -> T { + | ^^^^ required by this bound in `needs_test` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs new file mode 100644 index 00000000000..abc845d3afa --- /dev/null +++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs @@ -0,0 +1,12 @@ +#![feature(return_position_impl_trait_in_trait)] + +trait Iterable { + type Item<'a> + where + Self: 'a; + + fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>; + //~^ ERROR use of undeclared lifetime name `'missing` +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr new file mode 100644 index 00000000000..0d74c0b69ce --- /dev/null +++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr @@ -0,0 +1,23 @@ +error[E0261]: use of undeclared lifetime name `'missing` + --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:55 + | +LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>; + | ^^^^^^^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'missing` lifetime + | +LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>>; + | +++++++++++++ +help: consider introducing lifetime `'missing` here + | +LL | fn iter<'missing>(&self) -> impl Iterator<Item = Self::Item<'missing>>; + | ++++++++++ +help: consider introducing lifetime `'missing` here + | +LL | trait Iterable<'missing> { + | ++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/inference/type-infer-generalize-ty-var.rs b/tests/ui/inference/type-infer-generalize-ty-var.rs index a3d6916cbf7..8b4a8c32bb2 100644 --- a/tests/ui/inference/type-infer-generalize-ty-var.rs +++ b/tests/ui/inference/type-infer-generalize-ty-var.rs @@ -1,4 +1,6 @@ -// run-pass +// check-pass +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next #![allow(non_upper_case_globals)] #![allow(dead_code)] diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index 38fd92d7619..da0078698ae 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -9,8 +9,12 @@ LL | LL | x.use_mut(); | - borrow later used here | - = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using a `let` binding to create a longer lived value + | +LL ~ let binding = vec![1]; +LL ~ let mut x = binding.iter(); + | error: aborting due to previous error diff --git a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr index 4ecc6370d3c..9df7f0ffd0c 100644 --- a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr +++ b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr @@ -9,8 +9,12 @@ LL | LL | stuff(phantom_pinned) | -------------- borrow later used here | - = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `pin` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using a `let` binding to create a longer lived value + | +LL ~ let binding = pin!(PhantomPinned); +LL ~ let phantom_pinned = identity(binding); + | error[E0716]: temporary value dropped while borrowed --> $DIR/lifetime_errors_on_promotion_misusage.rs:18:30 diff --git a/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs b/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs new file mode 100644 index 00000000000..c2ac80459ca --- /dev/null +++ b/tests/ui/traits/new-solver/dont-coerce-infer-to-dyn.rs @@ -0,0 +1,17 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +use std::fmt::Display; +use std::rc::Rc; + +fn mk<T: ?Sized>(t: Option<&T>) -> Rc<T> { + todo!() +} + +fn main() { + let mut x = None; + let y = mk(x); + // Don't treat the line below as a unsize coercion `Rc<?0> ~> Rc<dyn Display>` + let z: Rc<dyn Display> = y; + x = Some(&1 as &dyn Display); +} |
