diff options
| author | bors <bors@rust-lang.org> | 2022-06-07 11:08:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-07 11:08:58 +0000 |
| commit | 7fe2c4b00dfbc33643e1af4b293eb057306a8339 (patch) | |
| tree | 89cb7f71b608fa16f00b3efd70c4afbefd51280a /src | |
| parent | 91cacb3faf987805675e39aca41859ec1fcabef3 (diff) | |
| parent | 95266530d5b97a51b4ad110733fa276f85c27b43 (diff) | |
| download | rust-7fe2c4b00dfbc33643e1af4b293eb057306a8339.tar.gz rust-7fe2c4b00dfbc33643e1af4b293eb057306a8339.zip | |
Auto merge of #97825 - Dylan-DPC:rollup-ya51k1k, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #97058 (Various refactors to the incr comp workproduct handling) - #97301 (Allow unstable items to be re-exported unstably without requiring the feature be enabled) - #97738 (Fix ICEs from zsts within unsized types with non-zero offsets) - #97771 (Remove SIGIO reference on Haiku) - #97808 (Add some unstable target features for the wasm target codegen) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
4 files changed, 94 insertions, 0 deletions
diff --git a/src/test/ui/stability-attribute/allow-unstable-reexport.rs b/src/test/ui/stability-attribute/allow-unstable-reexport.rs new file mode 100644 index 00000000000..937913954a7 --- /dev/null +++ b/src/test/ui/stability-attribute/allow-unstable-reexport.rs @@ -0,0 +1,30 @@ +// Allow an unstable re-export without requiring a feature gate. +// #94972 + +// aux-build:lint-stability.rs +// aux-build:lint-stability-reexport.rs +#![feature(staged_api)] +#![stable(feature = "lint_stability", since = "1.0.0")] + +extern crate lint_stability; +extern crate lint_stability_reexport; + +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub use lint_stability::unstable; + +// We want to confirm that using a re-export through another crate behaves +// the same way as using an item directly +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub use lint_stability_reexport::unstable_text; + +// Ensure items which aren't marked as unstable can't re-export unstable items +#[stable(feature = "lint_stability", since = "1.0.0")] +pub use lint_stability::unstable as unstable2; +//~^ ERROR use of unstable library feature 'unstable_test_feature' + +fn main() { + // Since we didn't enable the feature in this crate, we still can't + // use these items, even though they're in scope from the `use`s which are now allowed. + unstable(); //~ ERROR use of unstable library feature 'unstable_test_feature' + unstable_text(); //~ ERROR use of unstable library feature 'unstable_test_feature' +} diff --git a/src/test/ui/stability-attribute/allow-unstable-reexport.stderr b/src/test/ui/stability-attribute/allow-unstable-reexport.stderr new file mode 100644 index 00000000000..a11da9dc8a7 --- /dev/null +++ b/src/test/ui/stability-attribute/allow-unstable-reexport.stderr @@ -0,0 +1,27 @@ +error[E0658]: use of unstable library feature 'unstable_test_feature' + --> $DIR/allow-unstable-reexport.rs:22:9 + | +LL | pub use lint_stability::unstable as unstable2; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_test_feature' + --> $DIR/allow-unstable-reexport.rs:28:5 + | +LL | unstable(); + | ^^^^^^^^ + | + = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_test_feature': text + --> $DIR/allow-unstable-reexport.rs:29:5 + | +LL | unstable_text(); + | ^^^^^^^^^^^^^ + | + = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/stability-attribute/auxiliary/lint-stability-reexport.rs b/src/test/ui/stability-attribute/auxiliary/lint-stability-reexport.rs new file mode 100644 index 00000000000..9884731d562 --- /dev/null +++ b/src/test/ui/stability-attribute/auxiliary/lint-stability-reexport.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] +#![feature(staged_api)] +#![stable(feature = "lint_stability", since = "1.0.0")] + +extern crate lint_stability; + +// Re-exporting without enabling the feature "unstable_test_feature" in this crate +#[unstable(feature = "unstable_test_feature", issue = "none")] +pub use lint_stability::unstable_text; diff --git a/src/test/ui/unsized/issue-97732.rs b/src/test/ui/unsized/issue-97732.rs new file mode 100644 index 00000000000..72f76503396 --- /dev/null +++ b/src/test/ui/unsized/issue-97732.rs @@ -0,0 +1,28 @@ +// check-pass + +#![feature(coerce_unsized)] + +// Ensure that unsizing structs that contain ZSTs at non-zero offsets don't ICE + +use std::ops::CoerceUnsized; + +#[repr(C)] +pub struct BoxWithZstTail<T: ?Sized>(Box<T>, ()); + +impl<S: ?Sized, T: ?Sized> CoerceUnsized<BoxWithZstTail<T>> for BoxWithZstTail<S> where + Box<S>: CoerceUnsized<Box<T>> +{ +} + +pub fn noop_dyn_upcast_with_zst_tail( + b: BoxWithZstTail<dyn ToString + Send>, +) -> BoxWithZstTail<dyn ToString> { + b +} + +fn main() { + let original = "foo"; + let boxed = BoxWithZstTail(Box::new(original) as Box<dyn ToString + Send>, ()); + let noop_upcasted = noop_dyn_upcast_with_zst_tail(boxed); + assert_eq!(original, noop_upcasted.0.to_string()); +} |
