Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Avoid a doc alias attribute error.
Browse files Browse the repository at this point in the history
"error: doc alias attribute expects a string: #[doc(alias = "a")]"
This error can be seen in the tests at
rust-lang/rust#72780
  • Loading branch information
ratmice committed Sep 21, 2021
1 parent a1fce3a commit 9f1833f
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 152 deletions.
12 changes: 6 additions & 6 deletions src/avc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl AccessVectorCache {
/// set of options as the previous, still in scope, one.
///
/// See: `avc_open()`.
#[doc(alias("avc_open"))]
#[doc(alias="avc_open")]
pub fn initialize(options: &[(c_int, *const c_void)]) -> Result<RCSRef<Self>> {
let mut options: Vec<selinux_sys::selinux_opt> = options
.iter()
Expand Down Expand Up @@ -101,7 +101,7 @@ impl AccessVectorCache {
/// cached access decisions.
///
/// See: `avc_reset()`.
#[doc(alias("avc_reset"))]
#[doc(alias="avc_reset")]
pub fn reset(&self) -> Result<()> {
ret_val_to_result("avc_reset()", unsafe { selinux_sys::avc_reset() })
}
Expand All @@ -110,7 +110,7 @@ impl AccessVectorCache {
/// cache, but do not flush any cached access decisions.
///
/// See: `avc_cleanup()`.
#[doc(alias("avc_cleanup"))]
#[doc(alias="avc_cleanup")]
pub fn clean_up(&self) {
unsafe { selinux_sys::avc_cleanup() }
}
Expand All @@ -119,7 +119,7 @@ impl AccessVectorCache {
/// specified by `security_identifier_name`.
///
/// See: `avc_get_initial_sid()`.
#[doc(alias("avc_get_initial_sid"))]
#[doc(alias="avc_get_initial_sid")]
pub fn kernel_initial_security_id<'t>(
&'t self,
security_id_name: &str,
Expand All @@ -141,7 +141,7 @@ impl AccessVectorCache {
/// Return a security context for the given security identifier.
///
/// See: `avc_sid_to_context()`.
#[doc(alias("avc_sid_to_context"))]
#[doc(alias="avc_sid_to_context")]
pub fn security_context_from_security_id<'t>(
&'t self,
mut security_id: SecurityID,
Expand All @@ -163,7 +163,7 @@ impl AccessVectorCache {
/// Return a security identifier for the given security context.
///
/// See: `avc_context_to_sid()`.
#[doc(alias("avc_context_to_sid"))]
#[doc(alias="avc_context_to_sid")]
pub fn security_id_from_security_context<'t>(
&'t self,
context: SecurityContext,
Expand Down
4 changes: 2 additions & 2 deletions src/call_back/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ pub trait CallBack {
/// Get the current call back function, if one has been set.
///
/// See: `selinux_get_callback()`.
#[doc(alias("selinux_get_callback"))]
#[doc(alias="selinux_get_callback")]
fn get_call_back() -> Option<Self::CallBackType>;

/// Set or clear the call back function.
///
/// See: `selinux_set_callback()`.
#[doc(alias("selinux_set_callback"))]
#[doc(alias="selinux_set_callback")]
fn set_call_back(call_back: Option<Self::CallBackType>);
}

Expand Down
10 changes: 5 additions & 5 deletions src/context_restore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ where
/// Set a labeling handle for relabeling.
///
/// See: `selinux_restorecon_set_sehandle()`.
#[doc(alias("selinux_restorecon_set_sehandle"))]
#[doc(alias="selinux_restorecon_set_sehandle")]
pub fn with_labeler(labeler: &'l mut Labeler<T>) -> Self {
Self {
labeler: Some(labeler),
Expand All @@ -164,7 +164,7 @@ where
/// Set an alternate root path for relabeling.
///
/// See: `selinux_restorecon_set_alt_rootpath()`.
#[doc(alias("selinux_restorecon_set_alt_rootpath"))]
#[doc(alias="selinux_restorecon_set_alt_rootpath")]
pub fn set_alternative_root_path(&mut self, path: impl AsRef<Path>) -> Result<()> {
let c_path = os_str_to_c_string(path.as_ref().as_os_str())?;
let r = unsafe { selinux_sys::selinux_restorecon_set_alt_rootpath(c_path.as_ptr()) };
Expand All @@ -174,7 +174,7 @@ where
/// Add to the list of directories to be excluded from relabeling.
///
/// See: `selinux_restorecon_set_exclude_list()`.
#[doc(alias("selinux_restorecon_set_exclude_list"))]
#[doc(alias="selinux_restorecon_set_exclude_list")]
pub fn add_exclude_list<P>(
&mut self,
exclusion_patterns: impl IntoIterator<Item = P>,
Expand Down Expand Up @@ -203,7 +203,7 @@ where
/// Restore file(s) default SELinux security contexts.
///
/// See: `selinux_restorecon()`.
#[doc(alias("selinux_restorecon"))]
#[doc(alias="selinux_restorecon")]
pub fn restore_context_of_file_system_entry(
self,
path: impl AsRef<Path>,
Expand All @@ -222,7 +222,7 @@ where
/// `selinux_restorecon()`, `setfiles()` or `restorecon()`.
///
/// See: `selinux_restorecon_xattr()`.
#[doc(alias("selinux_restorecon_xattr"))]
#[doc(alias="selinux_restorecon_xattr")]
pub fn manage_security_sehash_xattr_entries(
dir_path: impl AsRef<Path>,
flags: XAttrFlags,
Expand Down
20 changes: 10 additions & 10 deletions src/label/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl<T: BackEnd> Labeler<T> {
/// Initialize a labeling handle to be used for lookup operations.
///
/// See: `selabel_open()`.
#[doc(alias("selabel_open"))]
#[doc(alias="selabel_open")]
pub fn new(options: &[(c_int, *const c_void)], raw_format: bool) -> Result<Self> {
use std::convert::TryInto;

Expand Down Expand Up @@ -81,7 +81,7 @@ impl<T: BackEnd> Labeler<T> {
/// Obtain SELinux security context from a string label.
///
/// See: `selabel_lookup()`.
#[doc(alias("selabel_lookup"))]
#[doc(alias="selabel_lookup")]
pub fn look_up(&self, key: &CStr, key_type: c_int) -> Result<SecurityContext> {
let (proc, proc_name): (unsafe extern "C" fn(_, _, _, _) -> _, _) = if self.is_raw {
(selinux_sys::selabel_lookup_raw, "selabel_lookup_raw()")
Expand All @@ -98,7 +98,7 @@ impl<T: BackEnd> Labeler<T> {
/// Return digest of spec files and list of files used.
///
/// See: `selabel_digest()`.
#[doc(alias("selabel_digest"))]
#[doc(alias="selabel_digest")]
pub fn digest(&'_ self) -> Result<Digest<'_>> {
let mut digest_ptr: *mut u8 = ptr::null_mut();
let mut digest_size = 0;
Expand Down Expand Up @@ -129,7 +129,7 @@ impl<T: BackEnd> Labeler<T> {
/// Print SELinux labeling statistics.
///
/// See: `selabel_stats()`.
#[doc(alias("selabel_stats"))]
#[doc(alias="selabel_stats")]
pub fn log_statistics(&self) {
unsafe { selinux_sys::selabel_stats(self.pointer.as_ptr()) }
}
Expand All @@ -147,7 +147,7 @@ impl<T: BackEnd> PartialOrd<Labeler<T>> for Labeler<T> {
/// Compare this instance to another one.
///
/// See: `selabel_cmp()`.
#[doc(alias("selabel_cmp"))]
#[doc(alias="selabel_cmp")]
fn partial_cmp(&self, other: &Labeler<T>) -> Option<cmp::Ordering> {
let r = unsafe { selinux_sys::selabel_cmp(self.pointer.as_ptr(), other.pointer.as_ptr()) };
match r {
Expand All @@ -169,7 +169,7 @@ impl Labeler<back_end::File> {
/// Return [`Labeler`] with default parameters for `selinux_restorecon()`.
///
/// See: `selinux_restorecon_default_handle()`.
#[doc(alias("selinux_restorecon_default_handle"))]
#[doc(alias="selinux_restorecon_default_handle")]
pub fn restorecon_default(raw_format: bool) -> Result<Self> {
let pointer = unsafe { selinux_sys::selinux_restorecon_default_handle() };
ptr::NonNull::new(pointer)
Expand All @@ -185,7 +185,7 @@ impl Labeler<back_end::File> {
/// Obtain SELinux security context from a path.
///
/// See: `selabel_lookup()`.
#[doc(alias("selabel_lookup"))]
#[doc(alias="selabel_lookup")]
pub fn look_up_by_path(
&self,
path: impl AsRef<Path>,
Expand All @@ -208,7 +208,7 @@ impl Labeler<back_end::File> {
/// Obtain a best match SELinux security context.
///
/// See: `selabel_lookup_best_match()`.
#[doc(alias("selabel_lookup_best_match"))]
#[doc(alias="selabel_lookup_best_match")]
pub fn look_up_best_match_by_path(
&self,
path: impl AsRef<Path>,
Expand Down Expand Up @@ -263,7 +263,7 @@ impl Labeler<back_end::File> {
/// Determine whether a direct or partial match is possible on a file path.
///
/// See: `selabel_partial_match()`.
#[doc(alias("selabel_partial_match"))]
#[doc(alias="selabel_partial_match")]
pub fn partial_match_by_path(&self, path: impl AsRef<Path>) -> Result<bool> {
let c_path = os_str_to_c_string(path.as_ref().as_os_str())?;
Ok(unsafe { selinux_sys::selabel_partial_match(self.pointer.as_ptr(), c_path.as_ptr()) })
Expand All @@ -273,7 +273,7 @@ impl Labeler<back_end::File> {
/// to the supplied path.
///
/// See: `selabel_get_digests_all_partial_matches()`.
#[doc(alias("selabel_get_digests_all_partial_matches"))]
#[doc(alias="selabel_get_digests_all_partial_matches")]
pub fn get_digests_all_partial_matches_by_path(
&self,
path: impl AsRef<Path>,
Expand Down
Loading

0 comments on commit 9f1833f

Please sign in to comment.