1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 23:17:42 +02:00

feat: forwards-compatibility for handler visibility inheritance fix (#3391)

This commit is contained in:
Rob Ede
2024-06-09 00:10:15 +01:00
committed by GitHub
parent 7c4c26d2df
commit ebc43dcf1b
7 changed files with 39 additions and 7 deletions

View File

@ -413,6 +413,13 @@ impl ToTokens for Route {
doc_attributes,
} = self;
#[allow(unused_variables)] // used when force-pub feature is disabled
let vis = &ast.vis;
// TODO(breaking): remove this force-pub forwards-compatibility feature
#[cfg(feature = "compat-routing-macros-force-pub")]
let vis = syn::Visibility::Public(<Token![pub]>::default());
let registrations: TokenStream2 = args
.iter()
.map(|args| {
@ -460,7 +467,7 @@ impl ToTokens for Route {
let stream = quote! {
#(#doc_attributes)*
#[allow(non_camel_case_types, missing_docs)]
pub struct #name;
#vis struct #name;
impl ::actix_web::dev::HttpServiceFactory for #name {
fn register(self, __config: &mut actix_web::dev::AppService) {