Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

add 5 rustdoc ices #1303

Merged
merged 1 commit into from
Jun 12, 2022
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
33 changes: 33 additions & 0 deletions ices/98002.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

cat > out.rs <<'EOF'


#![crate_name = "foo"]

#![feature(rustdoc_internals)]

// @has foo/index.html '//h2[@id="keywords"]' 'Keywords'
// @has foo/index.html '//a[@href="keyword.match.html"]' 'match'
// @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Keywords'
// @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#keywords'
// @has foo/keyword.match.html '//a[@class="keyword"]' 'match'
// @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match'
// @has foo/keyword.match.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
// @has foo/index.html '//a/@href' '../foo/index.html'
// @!has foo/foo/index.html
// @!has-dir foo/foo
// @!has foo/index.html '//span' '🔒'
#[doc(keyword = "match")]
/// this is a test!
mod foo{}

// @has foo/keyword.foo.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
#[doc(keyword = "foo")]
/// hello
mod bar {}


EOF

rustdoc --edition=2021 -Zunstable-options --output-format json out.rs
23 changes: 23 additions & 0 deletions ices/98003.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

cat > out.rs <<'EOF'


mod m1 {
pub fn f() {}
}
mod m2 {
pub fn f(_: u8) {}
}

pub use m1::*;
pub use m2::*;

pub mod glob {
pub use *;
}


EOF

rustdoc --edition=2015 -Zunstable-options --output-format json out.rs
16 changes: 16 additions & 0 deletions ices/98006.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

cat > out.rs <<'EOF'


#![feature(no_core)]
#![no_core]

#[doc(primitive = "usize")]
/// This is the built-in type `usize`.
mod usize {
}

EOF

rustdoc -Zunstable-options --output-format json --document-private-items out.rs
39 changes: 39 additions & 0 deletions ices/98007.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

cat > out.rs <<'EOF'


#![crate_name = "foo"]

// This test ensures that there is no "infinite redirection" file generated (a
// file which redirects to itself).

// We check it's not a redirection file.
// @has 'foo/builders/struct.ActionRowBuilder.html'
// @has - '//*[@id="synthetic-implementations"]' 'Auto Trait Implementations'

// And that the link in the module is targetting it.
// @has 'foo/builders/index.html'
// @has - '//a[@href="struct.ActionRowBuilder.html"]' 'ActionRowBuilder'

mod auto {
mod action_row {
pub struct ActionRowBuilder;
}

#[doc(hidden)]
pub mod builders {
pub use super::action_row::ActionRowBuilder;
}
}

pub use auto::*;

pub mod builders {
pub use crate::auto::builders::*;
}


EOF

rustdoc -Zunstable-options --output-format json --cap-lints warn --document-private-items --document-hidden-items out.rs
45 changes: 45 additions & 0 deletions ices/98009.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

cat > out.rs <<'EOF'


// run-rustfix
#![allow(dead_code)]

struct Events<R>(R);

struct Other;

pub trait Trait<T> {
fn handle(value: T) -> Self;
}

// Blanket impl. (If you comment this out, compiler figures out that it
// is passing an `&mut` to a method that must be expecting an `&mut`,
// and injects an auto-reborrow.)
impl<T, U> Trait<U> for T where T: From<U> {
fn handle(_: U) -> Self { unimplemented!() }
}

impl<'a, R> Trait<&'a mut Events<R>> for Other {
fn handle(_: &'a mut Events<R>) -> Self { unimplemented!() }
}

fn this_compiles<'a, R>(value: &'a mut Events<R>) {
for _ in 0..3 {
Other::handle(&mut *value);
}
}

fn this_does_not<'a, R>(value: &'a mut Events<R>) {
for _ in 0..3 {
Other::handle(value); //~ ERROR use of moved value: `value`
}
}

fn main() {}


EOF

rustdoc -Zunstable-options --output-format json --cap-lints warn --document-private-items --document-hidden-items out.rs