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

psx: Updates to panic info for 1.81.0 (~Jun 2024) #31

Merged
merged 3 commits into from
Aug 25, 2024
Merged

Conversation

hornc
Copy link
Contributor

@hornc hornc commented Aug 24, 2024

panic_info_message has been stable since 1.81.0
see
https://stackoverflow.com/questions/78900800/trying-to-access-the-panic-info-message-causes-a-mismatched-types-error
and
rust-lang/rust#115974

This PR

  • removes the if lets following the advice from the stackoverflow post above
  • removes the feature attribute for panic_info_message now that is is stable (since 1.81.0)

I was using the recent

rustc 1.82.0-nightly (4074d4902 2024-08-23)

Attempting cargo psx run of the Ferris example gave me errors like:

error[E0308]: mismatched types
  --> PATH_REDACTED/src/panic.rs:19:16
   |
19 |         if let Some(msg) = info.message() {
   |                ^^^^^^^^^   -------------- this expression has type `PanicMessage<'_>`
   |                |
   |                expected `PanicMessage<'_>`, found `Option<_>`
   |
   = note: expected struct `PanicMessage<'_>`
                found enum `Option<_>`

and also

warning: the feature `panic_info_message` has been stable since 1.81.0 and no longer requires an attribute to enable
  -->  PATH_REDACTED/psx-sdk-rs/psx/src/lib.rs:44:12
   |
44 | #![feature(panic_info_message)]
   |            ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(stable_features)]` on by default

@ayrtonm
Copy link
Owner

ayrtonm commented Aug 25, 2024

Thanks for the detailed PR @hornc! I think this removes stuff printed in a panic so could you add the {d}println! back in (i.e. remove only the if let)? Also it'd be good to bump the MSRV in the README from the 2022 date to the nightly you used. No need to find the exact nightly that introduced the change but this will break users on older compilers so it'd be good to document some version that works, but besides that LGTM.

@hornc hornc marked this pull request as draft August 25, 2024 01:56
@hornc hornc marked this pull request as ready for review August 25, 2024 02:50
@hornc
Copy link
Contributor Author

hornc commented Aug 25, 2024

Thanks @ayrtonm , I had just noticed I'd removed the useful output around the time you did ... I hit an out of memory panic when trying to run the donut example. I'm not sure what is causing that yet.

I have tested this change on the Ferris example (and some personal variations), and the hello-world example, which both work.

I'm planning to use psx-sdk-rs to make a few little game-like demos soon so I'm setting up a dev environment, but I need to re-learn PSX dev too :)

@ayrtonm
Copy link
Owner

ayrtonm commented Aug 25, 2024

I hit an out of memory panic when trying to run the donut example. I'm not sure what is causing that yet.

Maybe try switching sys_heap! to the heap backed by the linked list allocator crate or increasing the heap size? I don't remember the details offhand but I think some bios heap implementations are buggy.

I'm planning to use psx-sdk-rs to make a few little game-like demos soon so I'm setting up a dev environment, but I need to re-learn PSX dev too :)

nice! yeah feel free to make any changes you feel make the sdk nicer to work with :)

@ayrtonm ayrtonm merged commit fe4e0ec into ayrtonm:main Aug 25, 2024
1 check passed
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.

2 participants