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

Rust 1.77.1 #2746

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/libcgroups/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ pub fn get_all_pids(path: &Path) -> Result<Vec<Pid>, WrappedIoError> {
let file_path = p.join(CGROUP_PROCS);
if file_path.exists() {
let file = File::open(&file_path).wrap_open(&file_path)?;
for line in BufReader::new(file).lines().flatten() {
for line in BufReader::new(file).lines().map_while(Result::ok) {
result.push(Pid::from_raw(
line.parse::<i32>()
.map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidData, err))
Expand Down
1 change: 1 addition & 0 deletions crates/libcgroups/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
extern crate quickcheck;

#[cfg(test)]
#[allow(unused_imports)]
#[macro_use]
extern crate mockall;

Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/systemd/dbus_native/dbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl DbusConnection {
.filter(|m| m.preamble.mtype == MessageType::MethodReturn)
.collect();

let res = res.get(0).ok_or(DbusError::MethodCallErr(
let res = res.first().ok_or(DbusError::MethodCallErr(
"expected method call to have reply, found no reply message".into(),
))?;
let mut ctr = 0;
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/systemd/dbus_native/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'conn> Proxy<'conn> {
// we are only going to consider first reply, cause... so.
// realistically there should only be at most one method return type of message
// for a method call
let reply = reply.get(0).ok_or(DbusError::MethodCallErr(
let reply = reply.first().ok_or(DbusError::MethodCallErr(
"expected to get a reply for method call, didn't get any".into(),
))?;

Expand Down
1 change: 1 addition & 0 deletions crates/libcontainer/src/process/intel_rdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ fn write_resctrl_schemata(
// filesystem is pre-populated.
let mut file = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(schemata)
.map_err(IntelRdtError::OpenSchemata)?;
Expand Down
2 changes: 2 additions & 0 deletions crates/libcontainer/src/process/seccomp_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ mod tests {
let scmp_file = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(tmp_dir.path().join("scmp_file"))?;

std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(tmp_dir.path().join("socket_file.sock"))?;

let (mut main_sender, mut main_receiver) = channel::main_channel()?;
Expand Down
7 changes: 5 additions & 2 deletions crates/libcontainer/src/rootfs/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ impl Mount {

match mount.typ().as_deref() {
Some("cgroup") => {
match libcgroups::common::get_cgroup_setup().map_err(|err| {
let cgroup_setup = libcgroups::common::get_cgroup_setup().map_err(|err| {
tracing::error!("failed to determine cgroup setup: {}", err);
MountError::Other(err.into())
})? {
})?;
match cgroup_setup {
Legacy | Hybrid => {
#[cfg(not(feature = "v1"))]
panic!("libcontainer can't run in a Legacy or Hybrid cgroup setup without the v1 feature");
Expand Down Expand Up @@ -521,6 +522,7 @@ impl Mount {
if src.is_file() && !dest.exists() {
OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(dest)
.map_err(|err| {
Expand Down Expand Up @@ -686,6 +688,7 @@ mod tests {
let mount_option_config = parse_mount(mount)?;
OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(tmp_dir.path().join("null"))?;

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
profile="default"
channel="1.74.1"
channel="1.77.1"
2 changes: 1 addition & 1 deletion tests/contest/contest/src/tests/cgroups/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn create_spec(
// Gets the loopback interface and the first ethernet/wlan interface if it exists
fn get_network_interfaces() -> Option<(String, String)> {
let interfaces = interfaces();
let lo_if_name = interfaces.get(0).map(|iface| &iface.name)?;
let lo_if_name = interfaces.first().map(|iface| &iface.name)?;
let eth_if_name = interfaces.get(1).map(|iface| &iface.name)?;

Some((lo_if_name.to_string(), eth_if_name.to_string()))
Expand Down
7 changes: 4 additions & 3 deletions tests/contest/contest/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
pub mod support;
pub mod test_utils;

pub use support::{
generate_uuid, get_project_path, get_runtime_path, get_runtimetest_path, is_runtime_runc,
prepare_bundle, set_config, set_runtime_path,
generate_uuid, get_runtime_path, get_runtimetest_path, is_runtime_runc, prepare_bundle,
set_config,
};
pub use test_utils::{
create_container, delete_container, get_state, kill_container, test_inside_container,
test_outside_container, ContainerData, State,
test_outside_container, State,
};
3 changes: 3 additions & 0 deletions tests/contest/runtimetest/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ fn test_file_write_access(path: &str) -> Result<(), std::io::Error> {
fn test_dir_write_access(path: &str) -> Result<(), std::io::Error> {
let _ = std::fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(PathBuf::from(path).join("test.txt"))?;
Ok(())
Expand Down Expand Up @@ -144,6 +145,7 @@ pub fn test_device_access(path: &str) -> Result<(), std::io::Error> {
println!("test_device_access path: {path:?}");
let _ = std::fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(PathBuf::from(path).join("null"))?;
Ok(())
Expand All @@ -153,6 +155,7 @@ pub fn test_device_unaccess(path: &str) -> Result<(), std::io::Error> {
println!("test_device_unaccess path: {path:?}");
let _ = std::fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(PathBuf::from(path).join("null"))?;
Ok(())
Expand Down
Loading