Skip to content

Copy button copies incorrect code to clipboard  #712

@mtn

Description

@mtn

This issue originally came up here.

It seems like in some cases, the "Copy to clipboard button" copies incorrect code to the clipboard. For example (from that issue), we get this:

#![allow(unused_variables)]
#![feature(panic_implementation)]
#![feature(core_intrinsics)]
#![no_std]
#![no_main]

fn main() {
use core::intrinsics;
use core::panic::PanicInfo;

#[panic_implementation]
#[no_mangle]
fn panic(_info: &PanicInfo) -> ! {
    unsafe { intrinsics::abort() }
}

#[no_mangle]
pub fn _start() -> ! {
    loop {}
}
}

where we'd expect this:

#![feature(panic_implementation)]
#![feature(core_intrinsics)]
#![no_std]
#![no_main]

use core::intrinsics;
use core::panic::PanicInfo;

#[panic_implementation]
#[no_mangle]
fn panic(_info: &PanicInfo) -> ! {
    unsafe { intrinsics::abort() }
}

#[no_mangle]
pub fn _start() -> ! {
    loop {}
}

Edit: I guess it has something to do with a number of span class="hidden"s being created. What's the motivation behind these?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions