-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
cookie doctest failure #57943
Comments
Failing doctest: /// ```rust
/// use cookie::{CookieJar, Cookie};
///
/// let mut jar = CookieJar::new();
///
/// jar.add_original(Cookie::new("name", "value"));
/// jar.add_original(Cookie::new("second", "two"));
///
/// jar.add(Cookie::new("new", "third"));
/// jar.add(Cookie::new("another", "fourth"));
/// jar.add(Cookie::new("yac", "fifth"));
///
/// jar.remove(Cookie::named("name"));
/// jar.remove(Cookie::named("another"));
///
/// // There are three cookies in the jar: "second", "new", and "yac".
/// # assert_eq!(jar.iter().count(), 3);
/// for cookie in jar.iter() {
/// match cookie.name() {
/// "second" => assert_eq!(cookie.value(), "two"),
/// "new" => assert_eq!(cookie.value(), "third"),
/// "yac" => assert_eq!(cookie.value(), "fifth"),
/// _ => unreachable!("there are only three cookies in the jar")
/// }
/// }
/// ```
The assertion |
This is an internal bug in This program: extern crate cookie;
use std::collections::HashSet;
#[derive(Debug)]
struct A<'a>(&'a str, bool);
fn main() {
let mut a = HashSet::new();
a.insert(A("name", false));
a.insert(A("second", false));
let mut b = HashSet::new();
b.replace(A("new", false));
b.replace(A("another", false));
b.replace(A("yac", false));
b.replace(A("name", true));
b.remove(&A("another", false));
println!("{:?}", b.union(&a).collect::<Vec<_>>());
println!("{:?}", b.iter().chain(a.difference(&b)).collect::<Vec<_>>());
}
impl<'a> std::hash::Hash for A<'a> {
fn hash<H: std::hash::Hasher>(&self, h: &mut H) {
self.0.hash(h);
}
}
impl<'a> PartialEq for A<'a> {
fn eq(&self, other: &A<'a>) -> bool {
self.0 == other.0
}
}
impl<'a> Eq for A<'a> {
} has different output on stable/beta because of #57043. Both outputs are, however, correct. The tl;dr; everything is working as expected, this is a bug in the |
The cookie crate is failing a doc test on CookieJar::iter: https://crater-reports.s3.amazonaws.com/beta-1.33-1/beta-2019-01-22/reg/cookie-0.11.0/log.txt
I haven't looked into this more but it seems to happen pretty consistently on beta and nightly but I haven't reproduced on stable.
cc @alexcrichton
The text was updated successfully, but these errors were encountered: