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

Upgrade to rustls-native-certs 0.8 #285

Merged
merged 6 commits into from
Sep 4, 2024
Merged

Upgrade to rustls-native-certs 0.8 #285

merged 6 commits into from
Sep 4, 2024

Conversation

djc
Copy link
Member

@djc djc commented Aug 30, 2024

No description provided.

@djc djc requested review from cpu and ctz August 30, 2024 09:02
src/config.rs Outdated Show resolved Hide resolved
@djc djc force-pushed the native-certs-0.8 branch from 7be1f73 to cf3cb4b Compare September 2, 2024 11:22
@djc
Copy link
Member Author

djc commented Sep 2, 2024

"Simplify log macro setup" tries to make the log shim in this crate more like rustls', but so far I can't quite get it to work. As reported by CI, cargo test --no-default-features --features rustls-native-certs fails with

error[E0433]: failed to resolve: could not find `warn` in `log`
  --> src/config.rs:61:25
   |
61 |             crate::log::warn!("native root CA certificate loading errors: {errors:?}");
   |                         ^^^^ could not find `warn` in `log`

(Not sure what's different about these crates? What am I missing?)

If I skip that commit, I get this error:

error[E0659]: `warn` is ambiguous
  --> src/lib.rs:59:20
   |
59 |     pub(crate) use warn;
   |                    ^^^^ ambiguous name
   |
   = note: ambiguous because of a name conflict with a builtin attribute
   = note: `warn` could refer to a built-in attribute
note: `warn` could also refer to the macro defined here
  --> src/lib.rs:57:5
   |
57 |     macro_rules! warn    ( ($($tt:tt)*) => {{}} );
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If someone else wants to take a look, that would be great!

@ctz
Copy link
Member

ctz commented Sep 2, 2024

(Not sure what's different about these crates? What am I missing?)

I never got this to work as desired in rustls, though I think I now understand more about how macro visibility works. Over there it works in a weird way:

  • with feature "logging", code should import crate::log::warn and then call warn!("oh no");
  • without feature "logging", code should not import anything, but still can call warn!("oh no");

in the first case, the warn macro is imported from the log crate. in the second, it relies on #[macro_use] globalising the macro name within the crate (which I guess also works around the collision with the warn attribute.)

pushed a commit which avoids all that by keeping the macros local, and explicitly useing them to define their visibility, and then avoiding warn as a macro name.

if that looks good i'll squash it into your earlier commit?

@djc djc force-pushed the native-certs-0.8 branch from 1d0aba6 to bf8efc3 Compare September 2, 2024 13:02
@djc
Copy link
Member Author

djc commented Sep 2, 2024

Awesome, thanks! I took care of the squashing.

@djc djc force-pushed the native-certs-0.8 branch from bf8efc3 to 607676c Compare September 2, 2024 13:06
@djc djc requested a review from ctz September 3, 2024 08:11
Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

What happened with ef0f5ea ? It renders empty both in GitHub UI and when I git diff/git show it locally 🤔

@djc djc force-pushed the native-certs-0.8 branch from 607676c to 2e25331 Compare September 4, 2024 07:53
@djc
Copy link
Member Author

djc commented Sep 4, 2024

What happened with ef0f5ea ? It renders empty both in GitHub UI and when I git diff/git show it locally 🤔

Oops, took that commit out.

@djc djc enabled auto-merge September 4, 2024 07:56
@djc djc added this pull request to the merge queue Sep 4, 2024
Merged via the queue into main with commit dc54bc0 Sep 4, 2024
22 checks passed
@djc djc deleted the native-certs-0.8 branch September 4, 2024 08:12
@djc
Copy link
Member Author

djc commented Sep 4, 2024

  • Published hyper-rustls v0.27.3 at registry crates-io
  • [new tag] v/0.27.3 -> v/0.27.3
  • Release notes

Didn't call anything out in the release notes since it's just a grab bag of smaller stuff.

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