Skip to content

Commit

Permalink
Update MSRV to 1.81 (#8529)
Browse files Browse the repository at this point in the history
### Related
* #7485
* #8530


### What
Update MSRV to 1.81

---------

Co-authored-by: Jochen Görtler <[email protected]>
  • Loading branch information
emilk and grtlr authored Dec 19, 2024
1 parent 204fef0 commit 5a54e08
Show file tree
Hide file tree
Showing 43 changed files with 106 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.80.0
toolchain: 1.81.0

- run: cargo build -p rerun

Expand Down
4 changes: 2 additions & 2 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ cd rerun

Now install the `pixi` package manager: <https://github.com/prefix-dev/pixi?tab=readme-ov-file#installation>

Make sure `cargo --version` prints `1.80.0` once you are done.
Make sure `cargo --version` prints `1.81.0` once you are done.

If you are using an Apple-silicon Mac (M1, M2), make sure `rustc -vV` outputs `host: aarch64-apple-darwin`. If not, this should fix it:

```sh
rustup set default-host aarch64-apple-darwin && rustup install 1.80.0
rustup set default-host aarch64-apple-darwin && rustup install 1.81.0
```

## Git-lfs
Expand Down
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include = [
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rerun-io/rerun"
rust-version = "1.80"
rust-version = "1.81"
version = "0.22.0-alpha.1+dev"

[workspace.dependencies]
Expand Down Expand Up @@ -383,6 +383,7 @@ rust_2021_prelude_collisions = "warn"
semicolon_in_expressions_from_macros = "warn"
trivial_numeric_casts = "warn"
unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
unexpected_cfgs = "deny"
unused_extern_crates = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
Expand Down Expand Up @@ -467,7 +468,6 @@ match_same_arms = "warn"
match_wild_err_arm = "warn"
match_wildcard_for_single_variants = "warn"
mem_forget = "warn"
mismatched_target_os = "warn"
mismatching_type_param_order = "warn"
missing_enforced_import_renames = "warn"
missing_safety_doc = "warn"
Expand Down Expand Up @@ -496,6 +496,7 @@ ref_option_ref = "warn"
rest_pat_in_fully_bound_structs = "warn"
same_functions_in_if_condition = "warn"
semicolon_if_nothing_returned = "warn"
set_contains_or_insert = "warn"
should_panic_without_expect = "warn"
single_char_pattern = "warn"
single_match_else = "warn"
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# -----------------------------------------------------------------------------
# Section identical to the main scripts/clippy_wasm/clippy.toml:

msrv = "1.80"
msrv = "1.81"

allow-unwrap-in-tests = true

Expand Down
2 changes: 1 addition & 1 deletion crates/build/re_dev_tools/src/build_web_viewer/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub fn build(
cmd.arg("--no-default-features");
}
if !features.is_empty() {
cmd.arg(&format!("--features={features}"));
cmd.arg(format!("--features={features}"));
}
if profile == Profile::Release {
cmd.arg("--release");
Expand Down
7 changes: 4 additions & 3 deletions crates/utils/re_analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,13 @@ pub struct Analytics {
fn load_config() -> Result<Config, ConfigError> {
let config = match Config::load() {
Ok(config) => config,
#[allow(unused_variables)]

Err(err) => {
// NOTE: This will cause the first run disclaimer to show up again on native,
// and analytics will be disabled for the rest of the session.
#[cfg(not(target_arch = "wasm32"))]
re_log::warn!("failed to load analytics config file: {err}");
if !cfg!(target_arch = "wasm32") {
re_log::warn!("failed to load analytics config file: {err}");
}
None
}
};
Expand Down
107 changes: 55 additions & 52 deletions crates/utils/re_crash_handler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,69 +28,72 @@ pub fn install_crash_handlers(build_info: BuildInfo) {
fn install_panic_hook(_build_info: BuildInfo) {
let previous_panic_hook = std::panic::take_hook();

std::panic::set_hook(Box::new(move |panic_info: &std::panic::PanicInfo<'_>| {
let callstack = callstack_from(&["panicking::panic_fmt\n"]);

let file_line = panic_info.location().map(|location| {
let file = anonymize_source_file_path(&std::path::PathBuf::from(location.file()));
format!("{file}:{}", location.line())
});

let msg = panic_info_message(panic_info);

if let Some(msg) = &msg {
// Print our own panic message.
// Our formatting is nicer than `std` since we shorten the file paths (for privacy reasons).
// This also makes it easier for users to copy-paste the callstack into an issue
// without having any sensitive data in it.

let thread = std::thread::current();
let thread_name = thread
.name()
.map_or_else(|| format!("{:?}", thread.id()), |name| name.to_owned());

eprintln!("\nthread '{thread_name}' panicked at '{msg}'");
if let Some(file_line) = &file_line {
eprintln!("{file_line}");
std::panic::set_hook(Box::new(
move |panic_info: &std::panic::PanicHookInfo<'_>| {
let callstack = callstack_from(&["panicking::panic_fmt\n"]);

let file_line = panic_info.location().map(|location| {
let file = anonymize_source_file_path(&std::path::PathBuf::from(location.file()));
format!("{file}:{}", location.line())
});

let msg = panic_info_message(panic_info);

if let Some(msg) = &msg {
// Print our own panic message.
// Our formatting is nicer than `std` since we shorten the file paths (for privacy reasons).
// This also makes it easier for users to copy-paste the callstack into an issue
// without having any sensitive data in it.

let thread = std::thread::current();
let thread_name = thread
.name()
.map_or_else(|| format!("{:?}", thread.id()), |name| name.to_owned());

eprintln!("\nthread '{thread_name}' panicked at '{msg}'");
if let Some(file_line) = &file_line {
eprintln!("{file_line}");
}
eprintln!("stack backtrace:\n{callstack}");
} else {
// This prints the panic message and callstack:
(*previous_panic_hook)(panic_info);
}
eprintln!("stack backtrace:\n{callstack}");
} else {
// This prints the panic message and callstack:
(*previous_panic_hook)(panic_info);
}

econtext::print_econtext(); // Print additional error context, if any
econtext::print_econtext(); // Print additional error context, if any

eprintln!(
"\n\
eprintln!(
"\n\
Troubleshooting Rerun: https://www.rerun.io/docs/getting-started/troubleshooting \n\
Report bugs: https://github.com/rerun-io/rerun/issues"
);
);

#[cfg(feature = "analytics")]
{
if let Ok(analytics) = re_analytics::Analytics::new(std::time::Duration::from_millis(1))
#[cfg(feature = "analytics")]
{
analytics.record(re_analytics::event::CrashPanic {
build_info: _build_info,
callstack,
// Don't include panic message, because it can contain sensitive information,
// e.g. `panic!("Couldn't read {sensitive_file_path}")`.
message: None,
file_line,
});

std::thread::sleep(std::time::Duration::from_secs(1)); // Give analytics time to send the event
if let Ok(analytics) =
re_analytics::Analytics::new(std::time::Duration::from_millis(1))
{
analytics.record(re_analytics::event::CrashPanic {
build_info: _build_info,
callstack,
// Don't include panic message, because it can contain sensitive information,
// e.g. `panic!("Couldn't read {sensitive_file_path}")`.
message: None,
file_line,
});

std::thread::sleep(std::time::Duration::from_secs(1)); // Give analytics time to send the event
}
}
}

// We compile with `panic = "abort"`, but we don't want to report the same problem twice, so just exit:
#[allow(clippy::exit)]
std::process::exit(102);
}));
// We compile with `panic = "abort"`, but we don't want to report the same problem twice, so just exit:
#[allow(clippy::exit)]
std::process::exit(102);
},
));
}

fn panic_info_message(panic_info: &std::panic::PanicInfo<'_>) -> Option<String> {
fn panic_info_message(panic_info: &std::panic::PanicHookInfo<'_>) -> Option<String> {
// `panic_info.message` is unstable, so this is the recommended way of getting
// the panic message out. We need both the `&str` and `String` variants.

Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_ui/src/design_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct DesignTokens {
/// Color table for all colors used in the UI.
///
/// Loaded at startup from `design_tokens.json`.
color_table: ColorTable,
pub color_table: ColorTable,

// TODO(ab): get rid of these, they should be function calls like the rest.
pub top_bar_color: egui::Color32,
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub mod zoom_pan_area;
use egui::NumExt as _;

pub use self::{
color_table::{ColorToken, Hue, Scale},
color_table::{ColorTable, ColorToken, Hue, Scale},
command::{UICommand, UICommandSender},
command_palette::CommandPalette,
context_ext::ContextExt,
Expand Down
19 changes: 3 additions & 16 deletions crates/viewer/re_view_graph/src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ impl Node {
}
}

/// The original [`components::GraphNode`] id that was logged by the user.
pub fn graph_node(&self) -> &components::GraphNode {
match self {
Self::Explicit { instance, .. } => &instance.graph_node,
Self::Implicit { graph_node, .. } => graph_node,
}
}

pub fn label(&self) -> &DrawableLabel {
match self {
Self::Explicit { label, .. } | Self::Implicit { label, .. } => label,
Expand All @@ -81,6 +73,7 @@ pub struct Graph {
entity: EntityPath,
nodes: Vec<Node>,
edges: Vec<EdgeTemplate>,
#[expect(unused)]
kind: GraphType,
}

Expand Down Expand Up @@ -110,21 +103,19 @@ impl Graph {

let (edges, kind) = if let Some(data) = edge_data {
for edge in &data.edges {
if !seen.contains(&edge.source_index) {
if seen.insert(edge.source_index) {
nodes.push(Node::Implicit {
id: edge.source_index,
graph_node: edge.source.clone(),
label: DrawableLabel::implicit_circle(ui),
});
seen.insert(edge.source_index);
}
if !seen.contains(&edge.target_index) {
if seen.insert(edge.target_index) {
nodes.push(Node::Implicit {
id: edge.target_index,
graph_node: edge.target.clone(),
label: DrawableLabel::implicit_circle(ui),
});
seen.insert(edge.target_index);
}
}

Expand Down Expand Up @@ -155,10 +146,6 @@ impl Graph {
&self.edges
}

pub fn kind(&self) -> GraphType {
self.kind
}

pub fn entity(&self) -> &EntityPath {
&self.entity
}
Expand Down
2 changes: 2 additions & 0 deletions crates/viewer/re_view_graph/src/layout/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl EdgeGeometry {
}

/// The starting position of an edge.
#[expect(unused)]
pub fn source_pos(&self) -> Pos2 {
match self.path {
PathGeometry::Line { source, .. } | PathGeometry::CubicBezier { source, .. } => source,
Expand All @@ -53,6 +54,7 @@ impl EdgeGeometry {
}

/// The direction of the edge at the source node (normalized).
#[expect(unused)]
pub fn source_arrow_direction(&self) -> Vec2 {
use PathGeometry::{CubicBezier, Line};
match self.path {
Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_view_graph/src/layout/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl Layout {
}

/// Gets the shape of an edge in the final layout.
#[expect(unused)]
pub fn get_edge(&self, edge: &EdgeId) -> Option<&[EdgeGeometry]> {
self.edges.get(edge).map(|es| es.as_slice())
}
Expand Down
4 changes: 0 additions & 4 deletions crates/viewer/re_view_graph/src/ui/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ impl LayoutState {
*self = Self::None;
}

pub fn is_none(&self) -> bool {
matches!(self, Self::None)
}

pub fn is_in_progress(&self) -> bool {
matches!(self, Self::InProgress { .. })
}
Expand Down
2 changes: 0 additions & 2 deletions crates/viewer/re_view_graph/src/visualizers/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub enum Label {
/// A [`NodeInstance`] is the output of the [`NodeVisualizer`] and represents a single node in the graph.
#[derive(Clone)]
pub struct NodeInstance {
pub graph_node: components::GraphNode,
pub instance_index: Instance,
pub id: NodeId,
pub position: Option<egui::Pos2>,
Expand Down Expand Up @@ -128,7 +127,6 @@ impl VisualizerSystem for NodeVisualizer {
};

NodeInstance {
graph_node: node.clone(),
instance_index: instance,
id: NodeId::from_entity_node(&data_result.entity_path, node),
position: position.map(|[x, y]| egui::Pos2::new(x, y)),
Expand Down
2 changes: 2 additions & 0 deletions crates/viewer/re_view_tensor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ impl TensorDimension {
.collect()
}

#[allow(dead_code)] // Used for tests
pub fn unnamed(size: u64) -> Self {
Self { size, name: None }
}

#[allow(dead_code)] // Used for tests
pub fn named(size: u64, name: impl Into<re_types::ArrowString>) -> Self {
Self {
size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Let's try it out in a brand-new Rust project:
cargo init cube && cd cube && cargo add rerun --features native_viewer
```

Note that the Rerun SDK requires a working installation of Rust 1.80+.
Note that the Rerun SDK requires a working installation of Rust 1.81+.

## Logging your own data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Let's try it out in a brand-new Rust project:
cargo init cube && cd cube && cargo add rerun
```

Note that the Rerun SDK requires a working installation of Rust 1.80+.
Note that the Rerun SDK requires a working installation of Rust 1.81+.

## Logging your own data

Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/installing-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ There are many ways to install the viewer. Please pick whatever works best for y
- Download `rerun-cli` for your platform from the [GitHub Release artifacts](https://github.com/rerun-io/rerun/releases/latest/).
- Via Cargo
- `cargo binstall rerun-cli` - download binaries via [`cargo binstall`](https://github.com/cargo-bins/cargo-binstall)
- `cargo install rerun-cli --locked` - build it from source (this requires Rust 1.80+)
- `cargo install rerun-cli --locked` - build it from source (this requires Rust 1.81+)
- Together with the Rerun [Python SDK](./quick-start/python.md):
- `pip3 install rerun-sdk` - download it via pip
- `conda install -c conda-forge rerun-sdk` - download via Conda
Expand Down
2 changes: 1 addition & 1 deletion docs/content/getting-started/quick-start/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ order: 3

## Setup

The Rerun SDK for Rust requires a working installation of Rust 1.80+.
The Rerun SDK for Rust requires a working installation of Rust 1.81+.

After you have [installed the viewer](../installing-viewer.md#installing-the-viewer) you can simply add [the Rerun crate](https://crates.io/crates/rerun) to your project with `cargo add rerun`.

Expand Down
Loading

0 comments on commit 5a54e08

Please sign in to comment.