Updated to 1.35.0

This commit is contained in:
Алзим 2019-06-09 19:43:01 +03:00
parent aa2f9dbd03
commit 6530162c2f
5 changed files with 269 additions and 464 deletions

View file

@ -1,4 +1,4 @@
sources:
rust-1.33.0-i686-unknown-linux-gnu.tar.xz: 9fbd40945dbf0445ae6ba67e137f5a121182fbd8
rust-1.33.0-x86_64-unknown-linux-gnu.tar.xz: 72762436424bd4d727023922254fe9af857b2a20
rustc-1.34.1-src.tar.xz: 7a377dd8a5febc99ba23e5968503f9eefc905088
rust-1.34.0-i686-unknown-linux-gnu.tar.xz: b3558abaefc8c321a0960ae7564f17e54bbd75f1
rust-1.34.0-x86_64-unknown-linux-gnu.tar.xz: add8a99ec2d9d855f7089e192d3dbe2b95f12c89
rustc-1.35.0-src.tar.xz: 50cece3a9a40909c1042344e380e50681365e808

View file

@ -0,0 +1,24 @@
From 26e9a81c487f63c734bb7ac1739cdae2da2cb9b1 Mon Sep 17 00:00:00 2001
From: Mazdak Farrokhzad <twingoow@gmail.com>
Date: Mon, 15 Apr 2019 04:05:37 +0200
Subject: [PATCH] bump bootstrap; fix compiletest wrt. exclude_should_panic
---
src/tools/compiletest/src/main.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 9e3c49119dea..431fd7969be0 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -523,6 +523,7 @@ pub fn run_tests(config: &Config) {
pub fn test_opts(config: &Config) -> test::TestOpts {
test::TestOpts {
+ exclude_should_panic: false,
filter: config.filter.clone(),
filter_exact: config.filter_exact,
run_ignored: if config.run_ignored {
--
2.21.0

View file

@ -1,442 +0,0 @@
From 9efc93c96dd6746460cef916d307b72ba21a7fd0 Mon Sep 17 00:00:00 2001
From: Mark Rousskov <mark.simulacrum@gmail.com>
Date: Sun, 3 Mar 2019 09:29:59 -0700
Subject: [PATCH 1/2] Tools built by the bootstrap compiler must be built by it
This avoids building compilers that we don't need -- most tools will work
just fine with the downloaded compiler.
---
src/bootstrap/doc.rs | 6 ++-
src/bootstrap/test.rs | 10 ++--
src/bootstrap/tool.rs | 104 +++++++++++++++++++++++++++---------------
3 files changed, 78 insertions(+), 42 deletions(-)
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index e0ad0422a6ce..621e3a95473e 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -883,7 +883,11 @@ impl Step for ErrorIndex {
builder.info(&format!("Documenting error index ({})", target));
let out = builder.doc_out(target);
t!(fs::create_dir_all(&out));
- let mut index = builder.tool_cmd(Tool::ErrorIndex);
+ let compiler = builder.compiler(2, builder.config.build);
+ let mut index = tool::ErrorIndex::command(
+ builder,
+ compiler,
+ );
index.arg("html");
index.arg(out.join("error-index.html"));
index.arg(crate::channel::CFG_RELEASE_NUM);
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 51412f79c3d0..5abf9d699784 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -414,7 +414,6 @@ impl Step for Miri {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct CompiletestTest {
- stage: u32,
host: Interned<String>,
}
@@ -427,16 +426,14 @@ impl Step for CompiletestTest {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(CompiletestTest {
- stage: run.builder.top_stage,
host: run.target,
});
}
/// Runs `cargo test` for compiletest.
fn run(self, builder: &Builder<'_>) {
- let stage = self.stage;
let host = self.host;
- let compiler = builder.compiler(stage, host);
+ let compiler = builder.compiler(0, host);
let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
@@ -1426,7 +1423,10 @@ impl Step for ErrorIndex {
t!(fs::create_dir_all(&dir));
let output = dir.join("error-index.md");
- let mut tool = builder.tool_cmd(Tool::ErrorIndex);
+ let mut tool = tool::ErrorIndex::command(
+ builder,
+ builder.compiler(compiler.stage, builder.config.build),
+ );
tool.arg("markdown")
.arg(&output)
.env("CFG_BUILD", &builder.config.build)
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index fc1a17d54667..4f2aa0b795dc 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -250,9 +250,9 @@ pub fn prepare_tool_cargo(
cargo
}
-macro_rules! tool {
+macro_rules! bootstrap_tool {
($(
- $name:ident, $path:expr, $tool_name:expr, $mode:expr
+ $name:ident, $path:expr, $tool_name:expr
$(,llvm_tools = $llvm:expr)*
$(,is_external_tool = $external:expr)*
;
@@ -266,10 +266,7 @@ macro_rules! tool {
impl Tool {
pub fn get_mode(&self) -> Mode {
- let mode = match self {
- $(Tool::$name => $mode,)+
- };
- mode
+ Mode::ToolBootstrap
}
/// Whether this tool requires LLVM to run
@@ -282,27 +279,15 @@ macro_rules! tool {
impl<'a> Builder<'a> {
pub fn tool_exe(&self, tool: Tool) -> PathBuf {
- let stage = self.tool_default_stage(tool);
match tool {
$(Tool::$name =>
self.ensure($name {
- compiler: self.compiler(stage, self.config.build),
+ compiler: self.compiler(0, self.config.build),
target: self.config.build,
}),
)+
}
}
-
- pub fn tool_default_stage(&self, tool: Tool) -> u32 {
- // Compile the error-index in the same stage as rustdoc to avoid
- // recompiling rustdoc twice if we can. Otherwise compile
- // everything else in stage0 as there's no need to rebootstrap
- // everything.
- match tool {
- Tool::ErrorIndex if self.top_stage >= 2 => self.top_stage,
- _ => 0,
- }
- }
}
$(
@@ -321,7 +306,8 @@ macro_rules! tool {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure($name {
- compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+ // snapshot compiler
+ compiler: run.builder.compiler(0, run.builder.config.build),
target: run.target,
});
}
@@ -331,7 +317,7 @@ macro_rules! tool {
compiler: self.compiler,
target: self.target,
tool: $tool_name,
- mode: $mode,
+ mode: Mode::ToolBootstrap,
path: $path,
is_optional_tool: false,
source_type: if false $(|| $external)* {
@@ -347,21 +333,67 @@ macro_rules! tool {
}
}
-tool!(
- Rustbook, "src/tools/rustbook", "rustbook", Mode::ToolBootstrap;
- ErrorIndex, "src/tools/error_index_generator", "error_index_generator", Mode::ToolRustc;
- UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen", Mode::ToolBootstrap;
- Tidy, "src/tools/tidy", "tidy", Mode::ToolBootstrap;
- Linkchecker, "src/tools/linkchecker", "linkchecker", Mode::ToolBootstrap;
- CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap;
- Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
- BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
- RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
- RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
- is_external_tool = true;
- RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes", Mode::ToolBootstrap;
+bootstrap_tool!(
+ Rustbook, "src/tools/rustbook", "rustbook";
+ UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
+ Tidy, "src/tools/tidy", "tidy";
+ Linkchecker, "src/tools/linkchecker", "linkchecker";
+ CargoTest, "src/tools/cargotest", "cargotest";
+ Compiletest, "src/tools/compiletest", "compiletest", llvm_tools = true;
+ BuildManifest, "src/tools/build-manifest", "build-manifest";
+ RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
+ RustInstaller, "src/tools/rust-installer", "fabricate", is_external_tool = true;
+ RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes";
);
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct ErrorIndex {
+ pub compiler: Compiler,
+}
+
+impl ErrorIndex {
+ pub fn command(builder: &Builder<'_>, compiler: Compiler) -> Command {
+ let mut cmd = Command::new(builder.ensure(ErrorIndex {
+ compiler
+ }));
+ add_lib_path(
+ vec![PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host))],
+ &mut cmd,
+ );
+ cmd
+ }
+}
+
+impl Step for ErrorIndex {
+ type Output = PathBuf;
+
+ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
+ run.path("src/tools/error_index_generator")
+ }
+
+ fn make_run(run: RunConfig<'_>) {
+ // Compile the error-index in the same stage as rustdoc to avoid
+ // recompiling rustdoc twice if we can.
+ let stage = if run.builder.top_stage >= 2 { run.builder.top_stage } else { 0 };
+ run.builder.ensure(ErrorIndex {
+ compiler: run.builder.compiler(stage, run.builder.config.build),
+ });
+ }
+
+ fn run(self, builder: &Builder<'_>) -> PathBuf {
+ builder.ensure(ToolBuild {
+ compiler: self.compiler,
+ target: self.compiler.host,
+ tool: "error_index_generator",
+ mode: Mode::ToolRustc,
+ path: "src/tools/error_index_generator",
+ is_optional_tool: false,
+ source_type: SourceType::InTree,
+ extra_features: Vec::new(),
+ }).expect("expected to build -- essential tool")
+ }
+}
+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct RemoteTestServer {
pub compiler: Compiler,
@@ -625,7 +657,7 @@ impl<'a> Builder<'a> {
/// `host`.
pub fn tool_cmd(&self, tool: Tool) -> Command {
let mut cmd = Command::new(self.tool_exe(tool));
- let compiler = self.compiler(self.tool_default_stage(tool), self.config.build);
+ let compiler = self.compiler(0, self.config.build);
self.prepare_tool_cmd(compiler, tool, &mut cmd);
cmd
}
@@ -637,7 +669,7 @@ impl<'a> Builder<'a> {
fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
let host = &compiler.host;
let mut lib_paths: Vec<PathBuf> = vec![
- if compiler.stage == 0 && tool != Tool::ErrorIndex {
+ if compiler.stage == 0 {
self.build.rustc_snapshot_libdir()
} else {
PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))
From 03718ed67a7b8fd57fc27316ec57ac3bc0f13d06 Mon Sep 17 00:00:00 2001
From: Mark Rousskov <mark.simulacrum@gmail.com>
Date: Sun, 3 Mar 2019 09:50:56 -0700
Subject: [PATCH 2/2] Permit getting stage 0 rustdoc
This allows us to e.g. test compiletest, including doctests, in stage 0
without building a fresh compiler and rustdoc.
---
src/bootstrap/builder.rs | 15 +++++++--------
src/bootstrap/dist.rs | 2 +-
src/bootstrap/doc.rs | 8 ++++----
src/bootstrap/test.rs | 8 ++++----
src/bootstrap/tool.rs | 8 +++++---
5 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 7e6c0a9f52aa..f8b7f25a7543 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -668,20 +668,19 @@ impl<'a> Builder<'a> {
.map(|entry| entry.path())
}
- pub fn rustdoc(&self, host: Interned<String>) -> PathBuf {
- self.ensure(tool::Rustdoc { host })
+ pub fn rustdoc(&self, compiler: Compiler) -> PathBuf {
+ self.ensure(tool::Rustdoc { compiler })
}
- pub fn rustdoc_cmd(&self, host: Interned<String>) -> Command {
+ pub fn rustdoc_cmd(&self, compiler: Compiler) -> Command {
let mut cmd = Command::new(&self.out.join("bootstrap/debug/rustdoc"));
- let compiler = self.compiler(self.top_stage, host);
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
.env("RUSTC_SYSROOT", self.sysroot(compiler))
// Note that this is *not* the sysroot_libdir because rustdoc must be linked
// equivalently to rustc.
.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler))
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
- .env("RUSTDOC_REAL", self.rustdoc(host))
+ .env("RUSTDOC_REAL", self.rustdoc(compiler))
.env("RUSTDOC_CRATE_VERSION", self.rust_version())
.env("RUSTC_BOOTSTRAP", "1");
@@ -689,7 +688,7 @@ impl<'a> Builder<'a> {
cmd.env_remove("MAKEFLAGS");
cmd.env_remove("MFLAGS");
- if let Some(linker) = self.linker(host) {
+ if let Some(linker) = self.linker(compiler.host) {
cmd.env("RUSTC_TARGET_LINKER", linker);
}
cmd
@@ -751,7 +750,7 @@ impl<'a> Builder<'a> {
// This is the intended out directory for compiler documentation.
my_out = self.compiler_doc_out(target);
}
- let rustdoc = self.rustdoc(compiler.host);
+ let rustdoc = self.rustdoc(compiler);
self.clear_if_dirty(&my_out, &rustdoc);
} else if cmd != "test" {
match mode {
@@ -897,7 +896,7 @@ impl<'a> Builder<'a> {
.env(
"RUSTDOC_REAL",
if cmd == "doc" || cmd == "rustdoc" || (cmd == "test" && want_rustdoc) {
- self.rustdoc(compiler.host)
+ self.rustdoc(compiler)
} else {
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
},
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 2dae3f9135d8..3045cda125ee 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -479,7 +479,7 @@ impl Step for Rustc {
t!(fs::create_dir_all(image.join("bin")));
builder.cp_r(&src.join("bin"), &image.join("bin"));
- builder.install(&builder.rustdoc(compiler.host), &image.join("bin"), 0o755);
+ builder.install(&builder.rustdoc(compiler), &image.join("bin"), 0o755);
// Copy runtime DLLs needed by the compiler
if libdir != "bin" {
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index 621e3a95473e..ae329286486d 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -335,7 +335,7 @@ fn invoke_rustdoc(
let footer = builder.src.join("src/doc/footer.inc");
let version_info = out.join("version_info.html");
- let mut cmd = builder.rustdoc_cmd(compiler.host);
+ let mut cmd = builder.rustdoc_cmd(compiler);
let out = out.join("book");
@@ -415,7 +415,7 @@ impl Step for Standalone {
}
let html = out.join(filename).with_extension("html");
- let rustdoc = builder.rustdoc(compiler.host);
+ let rustdoc = builder.rustdoc(compiler);
if up_to_date(&path, &html) &&
up_to_date(&footer, &html) &&
up_to_date(&favicon, &html) &&
@@ -425,7 +425,7 @@ impl Step for Standalone {
continue
}
- let mut cmd = builder.rustdoc_cmd(compiler.host);
+ let mut cmd = builder.rustdoc_cmd(compiler);
cmd.arg("--html-after-content").arg(&footer)
.arg("--html-before-content").arg(&version_info)
.arg("--html-in-header").arg(&favicon)
@@ -824,7 +824,7 @@ impl Step for Rustdoc {
builder.ensure(Rustc { stage, target });
// Build rustdoc.
- builder.ensure(tool::Rustdoc { host: compiler.host });
+ builder.ensure(tool::Rustdoc { compiler: compiler });
// Symlink compiler docs to the output directory of rustdoc documentation.
let out_dir = builder.stage_out(compiler, Mode::ToolRustc)
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 5abf9d699784..6b9960c355c5 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -177,7 +177,7 @@ impl Step for Cargotest {
cmd.arg(&builder.initial_cargo)
.arg(&out_dir)
.env("RUSTC", builder.rustc(compiler))
- .env("RUSTDOC", builder.rustdoc(compiler.host)),
+ .env("RUSTDOC", builder.rustdoc(compiler)),
);
}
}
@@ -560,7 +560,7 @@ impl Step for RustdocTheme {
builder.sysroot_libdir(self.compiler, self.compiler.host),
)
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
- .env("RUSTDOC_REAL", builder.rustdoc(self.compiler.host))
+ .env("RUSTDOC_REAL", builder.rustdoc(self.compiler))
.env("RUSTDOC_CRATE_VERSION", builder.rust_version())
.env("RUSTC_BOOTSTRAP", "1");
if let Some(linker) = builder.linker(self.compiler.host) {
@@ -995,7 +995,7 @@ impl Step for Compiletest {
|| mode == "js-doc-test"
{
cmd.arg("--rustdoc-path")
- .arg(builder.rustdoc(compiler.host));
+ .arg(builder.rustdoc(compiler));
}
cmd.arg("--src-base")
@@ -1451,7 +1451,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
}
builder.info(&format!("doc tests for: {}", markdown.display()));
- let mut cmd = builder.rustdoc_cmd(compiler.host);
+ let mut cmd = builder.rustdoc_cmd(compiler);
builder.add_rust_test_threads(&mut cmd);
cmd.arg("--test");
cmd.arg(markdown);
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 4f2aa0b795dc..5fb83caac06c 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -430,7 +430,9 @@ impl Step for RemoteTestServer {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Rustdoc {
- pub host: Interned<String>,
+ /// This should only ever be 0 or 2.
+ /// We sometimes want to reference the "bootstrap" rustdoc, which is why this option is here.
+ pub compiler: Compiler,
}
impl Step for Rustdoc {
@@ -444,12 +446,12 @@ impl Step for Rustdoc {
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Rustdoc {
- host: run.host,
+ compiler: run.builder.compiler(run.builder.top_stage, run.host),
});
}
fn run(self, builder: &Builder<'_>) -> PathBuf {
- let target_compiler = builder.compiler(builder.top_stage, self.host);
+ let target_compiler = self.compiler;
if target_compiler.stage == 0 {
if !target_compiler.is_snapshot(builder) {
panic!("rustdoc in stage 0 must be snapshot rustdoc");

View file

@ -0,0 +1,229 @@
From 476732995c2f5dc08e20eb8f9f03c628a48f5f41 Mon Sep 17 00:00:00 2001
From: Oliver Scherer <github35764891676564198441@oli-obk.de>
Date: Thu, 23 May 2019 17:05:48 +0200
Subject: [PATCH 1/3] WIP
---
src/librustc_typeck/check/mod.rs | 22 +++++++++++-----------
src/test/run-pass/issue-60989.rs | 4 ++++
2 files changed, 15 insertions(+), 11 deletions(-)
create mode 100644 src/test/run-pass/issue-60989.rs
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 313ed19b945d..088729f12b1e 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -5396,17 +5396,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let tcx = self.tcx;
- match def {
- Def::Local(nid) | Def::Upvar(nid, ..) => {
- let hid = self.tcx.hir().node_to_hir_id(nid);
- let ty = self.local_ty(span, hid).decl_ty;
- let ty = self.normalize_associated_types_in(span, &ty);
- self.write_ty(hir_id, ty);
- return (ty, def);
- }
- _ => {}
- }
-
let (def, def_id, ty) = self.rewrite_self_ctor(def, span);
let path_segs = AstConv::def_ids_for_path_segments(self, segments, self_ty, def);
@@ -5469,6 +5458,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
user_self_ty = None;
}
+ match def {
+ Def::Local(nid) | Def::Upvar(nid, ..) => {
+ let hid = self.tcx.hir().node_to_hir_id(nid);
+ let ty = self.local_ty(span, hid).decl_ty;
+ let ty = self.normalize_associated_types_in(span, &ty);
+ self.write_ty(hir_id, ty);
+ return (ty, def);
+ }
+ _ => {}
+ }
+
// Now we have to compare the types that the user *actually*
// provided against the types that were *expected*. If the user
// did not provide any types, then we want to substitute inference
diff --git a/src/test/run-pass/issue-60989.rs b/src/test/run-pass/issue-60989.rs
new file mode 100644
index 000000000000..efaa74da3baa
--- /dev/null
+++ b/src/test/run-pass/issue-60989.rs
@@ -0,0 +1,4 @@
+fn main() {
+ let c1 = ();
+ c1::<()>;
+}
--
2.21.0
From 97f204e6ae43bfe0fed64221d709a194bef728a4 Mon Sep 17 00:00:00 2001
From: Oliver Scherer <github35764891676564198441@oli-obk.de>
Date: Thu, 23 May 2019 17:21:32 +0200
Subject: [PATCH 2/3] Make regression test a compile-fail test
---
src/test/{run-pass => compile-fail}/issue-60989.rs | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename src/test/{run-pass => compile-fail}/issue-60989.rs (100%)
diff --git a/src/test/run-pass/issue-60989.rs b/src/test/compile-fail/issue-60989.rs
similarity index 100%
rename from src/test/run-pass/issue-60989.rs
rename to src/test/compile-fail/issue-60989.rs
--
2.21.0
From 6e81f8205a6d47648d086d26e96bf05e962e3715 Mon Sep 17 00:00:00 2001
From: Eduard-Mihai Burtescu <edy.burt@gmail.com>
Date: Thu, 23 May 2019 19:23:00 +0300
Subject: [PATCH 3/3] rustc_typeck: don't produce a `DefId` or `Ty` from
`rewrite_self_ctor`, only a `Def`.
---
src/librustc_typeck/check/mod.rs | 30 ++++++++++++++++++----------
src/test/compile-fail/issue-60989.rs | 4 ----
src/test/ui/issue-60989.rs | 18 +++++++++++++++++
src/test/ui/issue-60989.stderr | 15 ++++++++++++++
4 files changed, 52 insertions(+), 15 deletions(-)
delete mode 100644 src/test/compile-fail/issue-60989.rs
create mode 100644 src/test/ui/issue-60989.rs
create mode 100644 src/test/ui/issue-60989.stderr
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 088729f12b1e..b6adcdbf35e9 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -5330,7 +5330,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}
// Rewrite `SelfCtor` to `Ctor`
- pub fn rewrite_self_ctor(&self, def: Def, span: Span) -> (Def, DefId, Ty<'tcx>) {
+ pub fn rewrite_self_ctor(&self, def: Def, span: Span) -> Def {
let tcx = self.tcx;
if let Def::SelfCtor(impl_def_id) = def {
let ty = self.impl_self_ty(span, impl_def_id).ty;
@@ -5340,8 +5340,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
Some(adt_def) if adt_def.has_ctor() => {
let variant = adt_def.non_enum_variant();
let ctor_def_id = variant.ctor_def_id.unwrap();
- let def = Def::Ctor(ctor_def_id, CtorOf::Struct, variant.ctor_kind);
- (def, ctor_def_id, tcx.type_of(ctor_def_id))
+ Def::Ctor(ctor_def_id, CtorOf::Struct, variant.ctor_kind)
}
_ => {
let mut err = tcx.sess.struct_span_err(span,
@@ -5364,16 +5363,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}
err.emit();
- (def, impl_def_id, tcx.types.err)
+ def
}
}
} else {
- let def_id = def.def_id();
-
- // The things we are substituting into the type should not contain
- // escaping late-bound regions, and nor should the base type scheme.
- let ty = tcx.type_of(def_id);
- (def, def_id, ty)
+ def
}
}
@@ -5396,7 +5390,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let tcx = self.tcx;
- let (def, def_id, ty) = self.rewrite_self_ctor(def, span);
+ let def = self.rewrite_self_ctor(def, span);
let path_segs = AstConv::def_ids_for_path_segments(self, segments, self_ty, def);
let mut user_self_ty = None;
@@ -5501,6 +5495,20 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
tcx.generics_of(*def_id).has_self
}).unwrap_or(false);
+ let (def_id, ty) = if let Def::SelfCtor(impl_def_id) = def {
+ // NOTE(eddyb) an error has already been emitted by `rewrite_self_ctor`,
+ // avoid using the wrong type here. This isn't in `rewrite_self_ctor`
+ // itself because that runs too early (see #60989).
+ (impl_def_id, tcx.types.err)
+ } else {
+ let def_id = def.def_id();
+
+ // The things we are substituting into the type should not contain
+ // escaping late-bound regions, and nor should the base type scheme.
+ let ty = tcx.type_of(def_id);
+ (def_id, ty)
+ };
+
let substs = AstConv::create_substs_for_generic_args(
tcx,
def_id,
diff --git a/src/test/compile-fail/issue-60989.rs b/src/test/compile-fail/issue-60989.rs
deleted file mode 100644
index efaa74da3baa..000000000000
--- a/src/test/compile-fail/issue-60989.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
- let c1 = ();
- c1::<()>;
-}
diff --git a/src/test/ui/issue-60989.rs b/src/test/ui/issue-60989.rs
new file mode 100644
index 000000000000..930e98bedce8
--- /dev/null
+++ b/src/test/ui/issue-60989.rs
@@ -0,0 +1,18 @@
+struct A {}
+struct B {}
+
+impl From<A> for B {
+ fn from(a: A) -> B {
+ B{}
+ }
+}
+
+fn main() {
+ let c1 = ();
+ c1::<()>;
+ //~^ ERROR type arguments are not allowed for this type
+
+ let c1 = A {};
+ c1::<Into<B>>;
+ //~^ ERROR type arguments are not allowed for this type
+}
diff --git a/src/test/ui/issue-60989.stderr b/src/test/ui/issue-60989.stderr
new file mode 100644
index 000000000000..55a0b9626df7
--- /dev/null
+++ b/src/test/ui/issue-60989.stderr
@@ -0,0 +1,15 @@
+error[E0109]: type arguments are not allowed for this type
+ --> $DIR/issue-60989.rs:12:10
+ |
+LL | c1::<()>;
+ | ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+ --> $DIR/issue-60989.rs:16:10
+ |
+LL | c1::<Into<B>>;
+ | ^^^^^^^ type argument not allowed
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0109`.
--
2.21.0

View file

@ -25,9 +25,9 @@
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD
# Note that cargo matches the program version here, not its crate version.
%define bootstrap_rust 1.33.0
%define bootstrap_cargo 1.33.0
%define bootstrap_date 2019-02-28
%define bootstrap_rust 1.34.0
%define bootstrap_cargo 1.34.0
%define bootstrap_date 2019-05-14
%bcond_without bootstrap
@ -61,7 +61,7 @@
Summary: The Rust Programming Language
Name: rust
Version: 1.34.1
Version: 1.35.0
Release: 1
License: (ASL 2.0 or MIT) and (BSD and MIT)
Group: Development/Rust
@ -75,16 +75,12 @@ Source10: rust.rpmlintrc
# Revert https://github.com/rust-lang/rust/pull/57840
# We do have the necessary fix in our LLVM 7.
Patch1: rust-pr57840-llvm7-debuginfo-variants.patch
%if %{with bootstrap}
# Fix 1.34.0 build failure with USE=doc
# also speed up bootstrap a bit with upstream commit
# Upstream patch url: https://github.com/rust-lang/rust/pull/58897
Patch2: 1.34.0-doc-build-fix.patch
%endif
%if %{mdkver} > 201610
# https://github.com/rust-lang/rust/pull/60313
Patch3: 0001-Limit-internalization-in-LLVM-8-ThinLTO.patch
%endif
Patch2: 0001-Limit-internalization-in-LLVM-8-ThinLTO.patch
# https://github.com/rust-lang/rust/pull/61085
Patch3: rust-pr61085-fix-ICE-with-incorrect-turbofish.patch
# https://github.com/rust-lang/rust/pull/59974/commits/26e9a81c487f63c734bb7ac1739cdae2da2cb9b1
Patch4: 0001-bump-bootstrap-fix-compiletest-wrt.-exclude_should_p.patch
BuildRequires: ncurses-devel
BuildRequires: curl
BuildRequires: pkgconfig(libcurl)
@ -205,8 +201,7 @@ Group: Development/Rust
Requires: lldb
Requires: python-lldb
Requires: %{name}-debugger-common = %{version}-%{release}
# It could be noarch, but lldb has limited availability
#BuildArch: noarch
BuildArch: noarch
%description lldb
This package includes the rust-lldb script,
@ -354,12 +349,11 @@ test -f '%{local_rust_root}/bin/rustc'
%setup -qn rustc-%{version}-src
%patch1 -p1 -R
%if %{with bootstrap}
%if %{mdkver} > 201610
%patch2 -p1
%endif
%if %{mdkver} > 201610
%patch3 -p1
%endif
%patch4 -p1
# python3
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure