-
Notifications
You must be signed in to change notification settings - Fork 13.5k
minicore: use core's diagnostic::on_unimplemented
messages
#143329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
//! # Important notes | ||
//! | ||
//! - `minicore` is **only** intended for `core` items, and the stubs should match the actual `core` | ||
//! items. | ||
//! items. For identical error output, any `diagnostic` attributes (e.g. `on_unimplemented`) | ||
//! should also be replicated here. | ||
//! - Be careful of adding new features and things that are only available for a subset of targets. | ||
//! | ||
//! # References | ||
|
@@ -41,12 +42,24 @@ macro_rules! impl_marker_trait { | |
} | ||
|
||
#[lang = "pointee_sized"] | ||
#[diagnostic::on_unimplemented( | ||
message = "values of type `{Self}` may or may not have a size", | ||
label = "may or may not have a known size" | ||
)] | ||
Comment on lines
+45
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion [DIAG 2/2]: if we decide to go with this, can you make sure to leave a comment mentioning needing to sync the diagnostics attribute in the real There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a note at the top of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make this easier to discover, can you also add this note additionally to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
pub trait PointeeSized {} | ||
|
||
#[lang = "meta_sized"] | ||
#[diagnostic::on_unimplemented( | ||
message = "the size for values of type `{Self}` cannot be known", | ||
label = "doesn't have a known size" | ||
)] | ||
pub trait MetaSized: PointeeSized {} | ||
|
||
#[lang = "sized"] | ||
#[diagnostic::on_unimplemented( | ||
message = "the size for values of type `{Self}` cannot be known at compilation time", | ||
label = "doesn't have a size known at compile-time" | ||
)] | ||
pub trait Sized: MetaSized {} | ||
|
||
#[lang = "legacy_receiver"] | ||
|
@@ -64,6 +77,10 @@ pub trait BikeshedGuaranteedNoDrop {} | |
pub unsafe auto trait Freeze {} | ||
|
||
#[lang = "unpin"] | ||
#[diagnostic::on_unimplemented( | ||
note = "consider using the `pin!` macro\nconsider using `Box::pin` if you need to access the pinned value outside of the current scope", | ||
message = "`{Self}` cannot be unpinned" | ||
)] | ||
pub auto trait Unpin {} | ||
|
||
impl_marker_trait!( | ||
|
@@ -110,6 +127,7 @@ pub struct UnsafeCell<T: PointeeSized> { | |
impl<T: PointeeSized> !Freeze for UnsafeCell<T> {} | ||
|
||
#[lang = "tuple_trait"] | ||
#[diagnostic::on_unimplemented(message = "`{Self}` is not a tuple")] | ||
pub trait Tuple {} | ||
|
||
#[rustc_builtin_macro] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
//@build-pass | ||
//@compile-flags: -Clink-dead-code=true --crate-type lib | ||
//@ add-core-stubs | ||
//@ build-pass | ||
//@ compile-flags: -Clink-dead-code=true | ||
// We used to not handle all "rustic" ABIs in a (relatively) uniform way, | ||
// so we failed to fix up arguments for actually passing through the ABI... | ||
#![feature(rust_cold_cc)] | ||
#![crate_type = "lib"] | ||
#![feature(no_core)] | ||
#![no_std] | ||
#![no_core] | ||
|
||
extern crate minicore; | ||
use minicore::*; | ||
|
||
pub extern "rust-cold" fn foo(_: [usize; 3]) {} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion [DIAG 1/2]: hm, this is kinda annoying because then you'd have to keep the diagnostic attribute content in sync, but I'm not sure of a better solution so this seems reasonable.