Check dyn*
return type correctly
This commit is contained in:
parent
63c748ee23
commit
75afb22331
@ -100,7 +100,7 @@ pub(super) fn check_fn<'a, 'tcx>(
|
||||
|
||||
inherited.typeck_results.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig);
|
||||
|
||||
if let ty::Dynamic(..) = declared_ret_ty.kind() {
|
||||
if let ty::Dynamic(_, _, ty::Dyn) = declared_ret_ty.kind() {
|
||||
// FIXME: We need to verify that the return type is `Sized` after the return expression has
|
||||
// been evaluated so that we have types available for all the nodes being returned, but that
|
||||
// requires the coerced evaluated type to be stored. Moving `check_return_expr` before this
|
||||
|
10
src/test/ui/dyn-star/return.rs
Normal file
10
src/test/ui/dyn-star/return.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(dyn_star)]
|
||||
//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
|
||||
fn _foo() -> dyn* Unpin {
|
||||
4usize
|
||||
}
|
||||
|
||||
fn main() {}
|
11
src/test/ui/dyn-star/return.stderr
Normal file
11
src/test/ui/dyn-star/return.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/return.rs:3:12
|
||||
|
|
||||
LL | #![feature(dyn_star)]
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
Loading…
Reference in New Issue
Block a user