From 1ac727772bd91b6e35b624e3252e6a6bd681c70b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 6 Dec 2018 22:47:09 +0100 Subject: [PATCH] Remove rustdoc old style files generation --- src/librustdoc/html/render.rs | 22 +--------------------- src/test/rustdoc/issue-19190.rs | 3 --- src/test/rustdoc/issue-21092.rs | 1 - src/test/rustdoc/issue-35169-2.rs | 8 -------- src/test/rustdoc/issue-35169.rs | 8 -------- src/test/rustdoc/macros.rs | 2 -- src/test/rustdoc/old-style-files.rs | 23 +++++++++++++++++++++++ src/test/rustdoc/src-links.rs | 2 -- src/test/rustdoc/structfields.rs | 5 ----- 9 files changed, 24 insertions(+), 50 deletions(-) create mode 100644 src/test/rustdoc/old-style-files.rs diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 86fb51419c2..4f237dc85a5 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -33,7 +33,7 @@ use std::error; use std::fmt::{self, Display, Formatter, Write as FmtWrite}; use std::ffi::OsStr; -use std::fs::{self, File, OpenOptions}; +use std::fs::{self, File}; use std::io::prelude::*; use std::io::{self, BufWriter, BufReader}; use std::mem; @@ -2229,26 +2229,6 @@ fn item(&mut self, item: clean::Item, all: &mut AllTypes, mut f: F) -> Result if !self.render_redirect_pages { all.append(full_path(self, &item), &item_type); } - // Redirect from a sane URL using the namespace to Rustdoc's - // URL for the page. - let redir_name = format!("{}.{}.html", name, item_type.name_space()); - let redir_dst = self.dst.join(redir_name); - if let Ok(redirect_out) = OpenOptions::new().create_new(true) - .write(true) - .open(&redir_dst) { - let mut redirect_out = BufWriter::new(redirect_out); - try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst); - } - - // If the item is a macro, redirect from the old macro URL (with !) - // to the new one (without). - if item_type == ItemType::Macro { - let redir_name = format!("{}.{}!.html", item_type, name); - let redir_dst = self.dst.join(redir_name); - let redirect_out = try_err!(File::create(&redir_dst), &redir_dst); - let mut redirect_out = BufWriter::new(redirect_out); - try_err!(layout::redirect(&mut redirect_out, file_name), &redir_dst); - } } } Ok(()) diff --git a/src/test/rustdoc/issue-19190.rs b/src/test/rustdoc/issue-19190.rs index a7c25538f7c..4d3b7622970 100644 --- a/src/test/rustdoc/issue-19190.rs +++ b/src/test/rustdoc/issue-19190.rs @@ -13,9 +13,6 @@ impl Deref for Bar { fn deref(&self) -> &Foo { loop {} } } -// @has issue_19190/Bar.t.html // @has issue_19190/struct.Bar.html -// @has - '//*[@id="foo.v"]' 'fn foo(&self)' // @has - '//*[@id="method.foo"]' 'fn foo(&self)' -// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-21092.rs b/src/test/rustdoc/issue-21092.rs index 14f547abd9a..b054145a483 100644 --- a/src/test/rustdoc/issue-21092.rs +++ b/src/test/rustdoc/issue-21092.rs @@ -3,7 +3,6 @@ extern crate issue_21092; -// @has issue_21092/Bar.t.html // @has issue_21092/struct.Bar.html // @has - '//*[@id="associatedtype.Bar"]' 'type Bar = i32' pub use issue_21092::{Foo, Bar}; diff --git a/src/test/rustdoc/issue-35169-2.rs b/src/test/rustdoc/issue-35169-2.rs index 0caead100d6..7dea268ec02 100644 --- a/src/test/rustdoc/issue-35169-2.rs +++ b/src/test/rustdoc/issue-35169-2.rs @@ -23,19 +23,11 @@ impl DerefMut for Bar { fn deref_mut(&mut self) -> &mut Foo { loop {} } } -// @has issue_35169_2/Bar.t.html // @has issue_35169_2/struct.Bar.html -// @has - '//*[@id="by_ref.v"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="by_explicit_ref.v"]' 'fn by_explicit_ref(self: &Foo)' // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @has - '//*[@id="by_mut_ref.v"]' 'fn by_mut_ref(&mut self)' // @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)' // @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box)' // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box)' // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/issue-35169.rs b/src/test/rustdoc/issue-35169.rs index 0978b103076..883d5d0158d 100644 --- a/src/test/rustdoc/issue-35169.rs +++ b/src/test/rustdoc/issue-35169.rs @@ -18,19 +18,11 @@ impl Deref for Bar { fn deref(&self) -> &Foo { loop {} } } -// @has issue_35169/Bar.t.html // @has issue_35169/struct.Bar.html -// @has - '//*[@id="by_ref.v"]' 'fn by_ref(&self)' // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)' -// @has - '//*[@id="by_explicit_ref.v"]' 'fn by_explicit_ref(self: &Foo)' // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)' -// @!has - '//*[@id="by_mut_ref.v"]' 'fn by_mut_ref(&mut self)' // @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)' -// @!has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)' // @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)' -// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box)' // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box)' -// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box)' // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box)' -// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()' // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()' diff --git a/src/test/rustdoc/macros.rs b/src/test/rustdoc/macros.rs index c66a2c845bf..fb4f02ad160 100644 --- a/src/test/rustdoc/macros.rs +++ b/src/test/rustdoc/macros.rs @@ -2,8 +2,6 @@ // @has - //pre '() => { ... };' // @has - //pre '($a:tt) => { ... };' // @has - //pre '($e:expr) => { ... };' -// @has macros/macro.my_macro!.html -// @has - //a 'macro.my_macro.html' #[macro_export] macro_rules! my_macro { () => []; diff --git a/src/test/rustdoc/old-style-files.rs b/src/test/rustdoc/old-style-files.rs new file mode 100644 index 00000000000..fb6697e18fb --- /dev/null +++ b/src/test/rustdoc/old-style-files.rs @@ -0,0 +1,23 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +// @has foo/macro.bar.html +// @!has foo/macro.bar!.html +// @!has foo/bar.m.html +#[macro_export] +macro_rules! bar { + () => {} +} + +// @has foo/struct.Bar.html +// @!has foo/Bar.t.html +pub struct Bar; diff --git a/src/test/rustdoc/src-links.rs b/src/test/rustdoc/src-links.rs index 902a319a7b9..353ce10243e 100644 --- a/src/test/rustdoc/src-links.rs +++ b/src/test/rustdoc/src-links.rs @@ -14,13 +14,11 @@ pub mod bar { // @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/src-links.rs.html' pub mod baz { /// Dox - // @has foo/bar/baz/baz.v.html // @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/src-links.rs.html' pub fn baz() { } } /// Dox - // @has foo/bar/Foobar.t.html // @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/src-links.rs.html' pub trait Foobar { fn dummy(&self) { } } diff --git a/src/test/rustdoc/structfields.rs b/src/test/rustdoc/structfields.rs index 35cea8afe21..cd8957aa2ec 100644 --- a/src/test/rustdoc/structfields.rs +++ b/src/test/rustdoc/structfields.rs @@ -1,6 +1,5 @@ // @has structfields/Foo.t.html // @has - struct.Foo.html -// @has structfields/struct.Foo.html pub struct Foo { // @has - //pre "pub a: ()" pub a: (), @@ -14,8 +13,6 @@ pub struct Foo { pub d: usize, } -// @has structfields/Bar.t.html -// @has - struct.Bar.html // @has structfields/struct.Bar.html pub struct Bar { // @has - //pre "pub a: ()" @@ -23,8 +20,6 @@ pub struct Bar { // @!has - //pre "// some fields omitted" } -// @has structfields/Qux.t.html -// @has - enum.Qux.html // @has structfields/enum.Qux.html pub enum Qux { Quz { -- 2.44.0