rust/tests/ui/transmutability/references/reject_lifetime_extension.stderr
Jack Wrenn 1ad218f3af safe transmute: Rename BikeshedIntrinsicFrom to TransmuteFrom
As our implementation of MCP411 nears completion and we begin to
solicit testing, it's no longer reasonable to expect testers to
type or remember `BikeshedIntrinsicFrom`. The name degrades the
ease-of-reading of documentation, and the overall experience of
using compiler safe transmute.

Tentatively, we'll instead adopt `TransmuteFrom`.

This name seems to be the one most likely to be stabilized, after
discussion on Zulip [1]. We may want to revisit the ordering of
`Src` and `Dst` before stabilization, at which point we'd likely
consider `TransmuteInto` or `Transmute`.

[1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20should.20.60BikeshedIntrinsicFrom.60.20be.20named.3F
2024-08-27 14:05:54 +00:00

79 lines
3.3 KiB
Plaintext

error: lifetime may not live long enough
--> $DIR/reject_lifetime_extension.rs:20:18
|
LL | fn extend_bare<'a>(src: &'a u8) -> &'static u8 {
| -- lifetime `'a` defined here
LL | unsafe { transmute(src) }
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/reject_lifetime_extension.rs:28:18
|
LL | fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 {
| -- lifetime `'a` defined here
LL | unsafe { transmute(src) }
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/reject_lifetime_extension.rs:36:18
|
LL | fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) {
| -- lifetime `'a` defined here
LL | unsafe { transmute(src) }
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/reject_lifetime_extension.rs:40:18
|
LL | fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) {
| -- lifetime `'a` defined here
LL | unsafe { transmute(src) }
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/reject_lifetime_extension.rs:50:18
|
LL | fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> {
| -- lifetime `'a` defined here
LL | unsafe { transmute(src) }
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/reject_lifetime_extension.rs:62:18
|
LL | fn extend_single<'a>(src: Single<'a>) -> Single<'static> {
| -- lifetime `'a` defined here
LL | unsafe { transmute(src) }
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: lifetime may not live long enough
--> $DIR/reject_lifetime_extension.rs:72:18
|
LL | fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> {
| -- lifetime `'a` defined here
LL | unsafe { transmute(src) }
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error[E0521]: borrowed data escapes outside of function
--> $DIR/reject_lifetime_extension.rs:80:18
|
LL | fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 {
| -- --- `src` is a reference that is only valid in the function body
| |
| lifetime `'a` defined here
LL | unsafe { extend_hrtb(src) }
| ^^^^^^^^^^^^^^^^
| |
| `src` escapes the function body here
| argument requires that `'a` must outlive `'static`
|
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
--> $DIR/reject_lifetime_extension.rs:85:25
|
LL | for<'b> &'b u8: TransmuteFrom<&'a u8>,
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0521`.