Skip to content

Commit

Permalink
Rephrase and line-break covariance error.
Browse files Browse the repository at this point in the history
  • Loading branch information
someguynamedjosh committed Feb 15, 2023
1 parent 79bac55 commit 8940b25
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ouroboros_examples"
version = "0.15.5"
version = "0.15.6"
authors = ["Joshua Maros <[email protected]>"]
edition = "2018"
license = "MIT OR Apache-2.0"
Expand All @@ -20,7 +20,7 @@ miri = []
__tokio = ["tokio"]

[dependencies]
ouroboros = { version = "0.15.5", path = "../ouroboros" }
ouroboros = { version = "0.15.6", path = "../ouroboros" }
tokio = { version = "1", features = [ "macros", "rt" ], optional = true }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions ouroboros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ouroboros"
version = "0.15.5"
version = "0.15.6"
authors = ["Joshua Maros <[email protected]>"]
edition = "2018"
license = "MIT OR Apache-2.0"
Expand All @@ -11,7 +11,7 @@ repository = "https://github.com/joshua-maros/ouroboros"

[dependencies]
aliasable = "0.1.3"
ouroboros_macro = { version = "0.15.5", path = "../ouroboros_macro" }
ouroboros_macro = { version = "0.15.6", path = "../ouroboros_macro" }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion ouroboros_macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ouroboros_macro"
version = "0.15.5"
version = "0.15.6"
authors = ["Joshua Maros <[email protected]>"]
edition = "2018"
license = "MIT OR Apache-2.0"
Expand Down
11 changes: 6 additions & 5 deletions ouroboros_macro/src/info_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ impl StructFieldInfo {
pub fn covariance_error(&self) {
let error = concat!(
"Ouroboros cannot automatically determine if this type is covariant.\n\n",
"If it is covariant, it should be legal to convert any instance of that type to an ",
"instance of that type where all usages of 'this are replaced with a smaller ",
"lifetime. For example, Box<&'this i32> is covariant because it is legal to use it as ",
"a Box<&'a i32> where 'this: 'a. In contrast, Fn(&'this i32) cannot be used as ",
"Fn(&'a i32).\n\n",
"As an example, a Box<&'this ()> is covariant because it can be used as a\n",
"Box<&'smaller ()> for any lifetime smaller than 'this. In contrast,\n",
"a Fn(&'this ()) is not covariant because it cannot be used as a\n",
"Fn(&'smaller ()). In general, values that are safe to use with smaller\n",
"lifetimes than they were defined with are covariant, breaking this \n",
"guarantee means the value is not covariant.\n\n",
"To resolve this error, add #[covariant] or #[not_covariant] to the field.\n",
);
proc_macro_error::emit_error!(self.typ, error);
Expand Down

0 comments on commit 8940b25

Please sign in to comment.