Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

gccrs#4695: Register rustc_conversion_suggestion

Link: Rust-GCC/gccrs#4695

Objective

This PR registers the rustc_conversion_suggestion attribute into the compiler.

Changes Made

It is currently implemented as a stub. When the compiler encounters this attribute, it simply ignores it and emits a warning rather than throwing a hard parsing error.

Why is this needed for alloc?

The alloc crate utilizes this attribute on standard traits like ToString. To successfully compile alloc, gccrs must be able to parse and gracefully handle this attribute, even if the hint mechanism itself isn’t fully implemented yet.

Test Case

#![allow(unused)]
fn main() {
pub trait ToString {
    #[rustc_conversion_suggestion]
    #[stable(feature = "rust1", since = "1.0.0")]
    fn to_string(&self) -> String;
}
}