error[E0308]: mismatched types
  --> $DIR/issue-84160.rs:5:12
   |
LL | fn mismatched_types_with_reference(x: &u32) -> &u32 {
   |                                                ---- expected `&u32` because of return type
...
LL |     return "test";
   |            ^^^^^^ expected `u32`, found `str`
   |
   = note: expected reference `&u32`
              found reference `&'static str`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
