Skip to content

Commit

Permalink
Split remaining offset_of features into new tracking issues
Browse files Browse the repository at this point in the history
  • Loading branch information
GKFX committed Jan 19, 2024
1 parent 803b810 commit 7924c9b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,9 @@ declare_features! (
/// casts in safe Rust to `dyn Trait` for such a `Trait` is also forbidden.
(unstable, object_safe_for_dispatch, "1.40.0", Some(43561)),
/// Allows using enums in offset_of!
(unstable, offset_of_enum, "1.75.0", Some(106655)),
(unstable, offset_of_enum, "1.75.0", Some(120141)),
/// Allows using multiple nested field accesses in offset_of!
(unstable, offset_of_nested, "CURRENT_RUSTC_VERSION", Some(106655)),
(unstable, offset_of_nested, "CURRENT_RUSTC_VERSION", Some(120140)),
/// Allows using `#[optimize(X)]`.
(unstable, optimize_attribute, "1.34.0", Some(54882)),
/// Allows macro attributes on expressions, statements and non-inline modules.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3250,7 +3250,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
&& !self.tcx.features().offset_of_nested
{
rustc_session::parse::feature_err(
&self.tcx.sess.parse_sess,
&self.tcx.sess,
sym::offset_of_nested,
ident_2.span,
"only a single ident or integer is stable as the field in offset_of",
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/feature-gates/feature-gate-offset-of-enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ error[E0658]: using enums in offset_of is experimental
LL | offset_of!(Alpha, One);
| ^^^
|
= note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
= note: see issue #120141 <https://github.com/rust-lang/rust/issues/120141> for more information
= help: add `#![feature(offset_of_enum)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

Expand All @@ -29,7 +29,7 @@ error[E0658]: using enums in offset_of is experimental
LL | offset_of!(Alpha, Two.0);
| ^^^
|
= note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
= note: see issue #120141 <https://github.com/rust-lang/rust/issues/120141> for more information
= help: add `#![feature(offset_of_enum)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

Expand Down
15 changes: 10 additions & 5 deletions tests/ui/feature-gates/feature-gate-offset-of-nested.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ error[E0658]: only a single ident or integer is stable as the field in offset_of
LL | offset_of!(Alpha, Two.0);
| ^
|
= note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
= note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information
= help: add `#![feature(offset_of_nested)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: only a single ident or integer is stable as the field in offset_of
--> $DIR/feature-gate-offset-of-nested.rs:24:33
Expand All @@ -19,8 +20,9 @@ LL | | offset_of!((S, ()), 0.c);
LL | | offset_of!(S, c.t);
... |
|
= note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
= note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information
= help: add `#![feature(offset_of_nested)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: only a single ident or integer is stable as the field in offset_of
Expand All @@ -29,26 +31,29 @@ error[E0658]: only a single ident or integer is stable as the field in offset_of
LL | offset_of!(S, b.0);
| ^
|
= note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
= note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information
= help: add `#![feature(offset_of_nested)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: only a single ident or integer is stable as the field in offset_of
--> $DIR/feature-gate-offset-of-nested.rs:26:27
|
LL | offset_of!((S, ()), 0.c);
| ^
|
= note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
= note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information
= help: add `#![feature(offset_of_nested)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: only a single ident or integer is stable as the field in offset_of
--> $DIR/feature-gate-offset-of-nested.rs:27:21
|
LL | offset_of!(S, c.t);
| ^
|
= note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
= note: see issue #120140 <https://github.com/rust-lang/rust/issues/120140> for more information
= help: add `#![feature(offset_of_nested)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 5 previous errors

Expand Down

0 comments on commit 7924c9b

Please sign in to comment.