Skip to content
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

remove unknown nightly feature 'const_ptr_offset' #22

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

tsatke
Copy link
Contributor

@tsatke tsatke commented Mar 28, 2022

This seems to let it build again.

Seems related to rust-lang/rust#71499 and rust-lang/rust#93957

Copy link
Contributor

@josephlr josephlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phil-opp this also fixes some build failures for the x86_64 crate. See https://github.com/rust-osdev/x86_64/runs/5715700359

@phil-opp
Copy link
Member

Thanks a lot!

@phil-opp phil-opp merged commit 2c52b5c into rust-osdev:master Mar 28, 2022
phil-opp added a commit that referenced this pull request Mar 28, 2022
@phil-opp
Copy link
Member

Published as v0.2.17

@tsatke tsatke deleted the patch-1 branch March 28, 2022 10:49
haowqs added a commit to haowqs/td-shim that referenced this pull request Mar 29, 2022
Problem statement:

An error will be reported after the uart version is updated:

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:28:36
   |
28 |             int_en: AtomicPtr::new(base_pointer.add(1)),
   |                                    ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:29:39
   |
29 |             fifo_ctrl: AtomicPtr::new(base_pointer.add(2)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:30:39
   |
30 |             line_ctrl: AtomicPtr::new(base_pointer.add(3)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:31:40
   |
31 |             modem_ctrl: AtomicPtr::new(base_pointer.add(4)),
   |                                        ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:32:38
   |
32 |             line_sts: AtomicPtr::new(base_pointer.add(5)),
   |                                      ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: could not compile `uart_16550` due to 5 previous errors

Investigation:

uart_16550 update

- Remove stabilized nightly feature 'const_ptr_offset' ([confidential-containers#22](rust-osdev/uart_16550#22))

Solution:

fixed uart_16550 version to 0.2.14

Signed-off-by: haowei <WeiX.Hao@intel.com>
haowqs added a commit to haowqs/td-shim that referenced this pull request Mar 29, 2022
Problem statement:

An error will be reported after the uart version is updated:

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:28:36
   |
28 |             int_en: AtomicPtr::new(base_pointer.add(1)),
   |                                    ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:29:39
   |
29 |             fifo_ctrl: AtomicPtr::new(base_pointer.add(2)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:30:39
   |
30 |             line_ctrl: AtomicPtr::new(base_pointer.add(3)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:31:40
   |
31 |             modem_ctrl: AtomicPtr::new(base_pointer.add(4)),
   |                                        ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:32:38
   |
32 |             line_sts: AtomicPtr::new(base_pointer.add(5)),
   |                                      ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: could not compile `uart_16550` due to 5 previous errors

Investigation + root cause:

View recent updates to uart_16550

uart_16550 updated.

- Remove stabilized nightly feature 'const_ptr_offset' ([confidential-containers#22](rust-osdev/uart_16550#22))

Solution:

fixed uart_16550 version to 0.2.14

Signed-off-by: haowei <WeiX.Hao@intel.com>
jyao1 pushed a commit to confidential-containers/td-shim that referenced this pull request Mar 30, 2022
Problem statement:

An error will be reported after the uart version is updated:

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:28:36
   |
28 |             int_en: AtomicPtr::new(base_pointer.add(1)),
   |                                    ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:29:39
   |
29 |             fifo_ctrl: AtomicPtr::new(base_pointer.add(2)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:30:39
   |
30 |             line_ctrl: AtomicPtr::new(base_pointer.add(3)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:31:40
   |
31 |             modem_ctrl: AtomicPtr::new(base_pointer.add(4)),
   |                                        ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:32:38
   |
32 |             line_sts: AtomicPtr::new(base_pointer.add(5)),
   |                                      ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: could not compile `uart_16550` due to 5 previous errors

Investigation + root cause:

View recent updates to uart_16550

uart_16550 updated.

- Remove stabilized nightly feature 'const_ptr_offset' ([#22](rust-osdev/uart_16550#22))

Solution:

fixed uart_16550 version to 0.2.14

Signed-off-by: haowei <WeiX.Hao@intel.com>
haowqs added a commit to haowqs/td-shim that referenced this pull request Mar 30, 2022
Problem statement:

An error will be reported after the uart version is updated:

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:28:36
   |
28 |             int_en: AtomicPtr::new(base_pointer.add(1)),
   |                                    ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:29:39
   |
29 |             fifo_ctrl: AtomicPtr::new(base_pointer.add(2)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:30:39
   |
30 |             line_ctrl: AtomicPtr::new(base_pointer.add(3)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:31:40
   |
31 |             modem_ctrl: AtomicPtr::new(base_pointer.add(4)),
   |                                        ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:32:38
   |
32 |             line_sts: AtomicPtr::new(base_pointer.add(5)),
   |                                      ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: could not compile `uart_16550` due to 5 previous errors

Investigation + root cause:

View recent updates to uart_16550

uart_16550 updated.

- Remove stabilized nightly feature 'const_ptr_offset' ([confidential-containers#22](rust-osdev/uart_16550#22))

Solution:

fixed uart_16550 version to 0.2.14

Signed-off-by: haowei <WeiX.Hao@intel.com>
jyao1 pushed a commit to confidential-containers/td-shim that referenced this pull request Mar 30, 2022
Problem statement:

An error will be reported after the uart version is updated:

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:28:36
   |
28 |             int_en: AtomicPtr::new(base_pointer.add(1)),
   |                                    ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:29:39
   |
29 |             fifo_ctrl: AtomicPtr::new(base_pointer.add(2)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:30:39
   |
30 |             line_ctrl: AtomicPtr::new(base_pointer.add(3)),
   |                                       ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:31:40
   |
31 |             modem_ctrl: AtomicPtr::new(base_pointer.add(4)),
   |                                        ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: `ptr::mut_ptr::<impl *mut T>::add` is not yet stable as a const fn
  --> /home/runner/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/uart_16550-0.2.17/src/mmio.rs:32:38
   |
32 |             line_sts: AtomicPtr::new(base_pointer.add(5)),
   |                                      ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_ptr_offset)]` to the crate attributes to enable

error: could not compile `uart_16550` due to 5 previous errors

Investigation + root cause:

View recent updates to uart_16550

uart_16550 updated.

- Remove stabilized nightly feature 'const_ptr_offset' ([#22](rust-osdev/uart_16550#22))

Solution:

fixed uart_16550 version to 0.2.14

Signed-off-by: haowei <WeiX.Hao@intel.com>
@phip1611
Copy link
Contributor

I am aware of that people break builds with feature updates (0.x.y) from time to time (especially if major is still 0) but breaking builds in bugfix updates is a bit.. unexpected. This broke my builds :)

@josephlr
Copy link
Contributor

This change was a necessary bugfix to allow this crate to continue building on the latest nightly. Without this change, the crate would no longer compile.

Im confused how this actually broke you though. This change should be fine on older rustc versions. What specific compiler error are you getting? What version of rustc are you using? Are you using version 0.2.18 of this crate?

@phip1611
Copy link
Contributor

phip1611 commented Jul 24, 2022

This change was a necessary bugfix to allow this crate to continue building on the latest nightly. Without this change, the crate would no longer compile.

Ah okay, I see. Well, this is my project respectively the fix: phip1611/diplomarbeit-impl@7296fbc It's on 1.61 nightly. I could fix this by pinning version 0.2.16.

@phil-opp
Copy link
Member

phil-opp commented Jul 24, 2022

Changed feature gates are the main difficulty of maintaining crates that target nightly Rust. Often, there is no way to keep supporting older nightly versions in such cases. In this case, the older nightlies expect the feature gate, but the newer ones throw an error because the feature gate no longer exists (since the feature was stabilized).

We had a lot of similar cases for the x86_64 crate and decided to resolve it by supporting only the latest nightly. Under this policy, we don't consider updating/removing feature gates as breaking changes because it effectively fixes a compile error.

The main reason for doing only patch releases as opposed to changing the minor version are transitive dependencies. For example, if we did a minor version bump for each feature gate update in x86_64, all dependent (library) crates would require a new release as well since cargo update only updates the patch version for v0.x.y crates. Coordinating this across different crates maintained by different people was a lot of effort and led to much more breakage. Because of this, we decided to consider such updates as bugfixes from then on and that policy worked much better.

That being said, it might be possible to continue supporting older nightlies through cfg attributes depending on the nightly version. However, I'm not sure if this is worth the effort. It would only work in certain cases and we don't want to increase the maintenance burden too much. Moving the crates to stable Rust as soon as possible seems like the better solution.

@phip1611
Copy link
Contributor

phip1611 commented Jul 24, 2022

Yeah, I agree. The longer I think about it, the more your approach makes sense. That's what people have to expect when working on nightly Rust.

through cfg attributes depending on the nightly

Probably overkill, as long as the lib doesn't have 100k active users :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants