Repository navigation
Conversation
|
r? @tiif rustbot has assigned @tiif. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
You will need to write a cross-crate test to test the behavior of using #[allow_internal_unstable(..)] across upstream and downstream crates.
In tests/ui/structs/default-field-values/auxiliary/, you can define the upstream crate, for example aux.rs with something like...
#![feature(default_field_values)]
#![feature(allow_internal_unstable)]
#[allow_internal_unstable(default_field_values)]
#[macro_export]
macro_rules! foo {
() => { fn foo() { struct Foo {x: usize = 0, } Foo {..}; } };
}In tests/ui/structs/default-field-values/allow_internal_unstable.rs, you can use the macro with...
//@ aux-build:aux.rs
//@check-pass
extern crate aux;
use aux::foo;
foo!();
fn main(){You will see different behavior in downstream crate when allow_internal_unstable is used and when it is not used.
| if !(self.tcx.features().default_field_values() | ||
| || span.allows_unstable(sym::default_field_values)) | ||
| { |
There was a problem hiding this comment.
The idea that I get from this diff is whenever we use #[allow_internal_unstable(default_field_values)]], we always execute the if path below that suggests adding #![feature(default_field_values)]? I feel I am missing something 🤔
Followup to #164329
It's somewhat inconvenient, for 3rd party lint tool authors, to have to enable a feature that's really an implementation detail of the macro.