diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 9b5b793363b5b..e5d6aebe97a0d 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -1801,7 +1801,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
crate_lint: CrateLint,
) -> PartialRes {
tracing::debug!(
- "smart_resolve_path_fragment(id={:?},qself={:?},path={:?}",
+ "smart_resolve_path_fragment(id={:?}, qself={:?}, path={:?})",
id,
qself,
path
@@ -1841,11 +1841,10 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
// Before we start looking for candidates, we have to get our hands
// on the type user is trying to perform invocation on; basically:
- // we're transforming `HashMap::new` into just `HashMap`
- let path = if let Some((_, path)) = path.split_last() {
- path
- } else {
- return Some(parent_err);
+ // we're transforming `HashMap::new` into just `HashMap`.
+ let path = match path.split_last() {
+ Some((_, path)) if !path.is_empty() => path,
+ _ => return Some(parent_err),
};
let (mut err, candidates) =
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 9d73c3b4424cb..a6d4dcb34c1a8 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1290,7 +1290,7 @@ pub fn parse_error_format(
error_format
}
-fn parse_crate_edition(matches: &getopts::Matches) -> Edition {
+pub fn parse_crate_edition(matches: &getopts::Matches) -> Edition {
let edition = match matches.opt_str("edition") {
Some(arg) => Edition::from_str(&arg).unwrap_or_else(|_| {
early_error(
diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs
index b1d98d75196d5..c6cc54d71211a 100644
--- a/compiler/rustc_typeck/src/collect.rs
+++ b/compiler/rustc_typeck/src/collect.rs
@@ -331,6 +331,11 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
span: Span,
) -> &'tcx Const<'tcx> {
bad_placeholder_type(self.tcx(), vec![span]).emit();
+ // Typeck doesn't expect erased regions to be returned from `type_of`.
+ let ty = self.tcx.fold_regions(ty, &mut false, |r, _| match r {
+ ty::ReErased => self.tcx.lifetimes.re_static,
+ _ => r,
+ });
self.tcx().const_error(ty)
}
@@ -1536,6 +1541,12 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
match get_infer_ret_ty(&sig.decl.output) {
Some(ty) => {
let fn_sig = tcx.typeck(def_id).liberated_fn_sigs()[hir_id];
+ // Typeck doesn't expect erased regions to be returned from `type_of`.
+ let fn_sig = tcx.fold_regions(fn_sig, &mut false, |r, _| match r {
+ ty::ReErased => tcx.lifetimes.re_static,
+ _ => r,
+ });
+
let mut visitor = PlaceholderHirTyCollector::default();
visitor.visit_ty(ty);
let mut diag = bad_placeholder_type(tcx, visitor.0);
@@ -1564,6 +1575,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
}
}
diag.emit();
+
ty::Binder::bind(fn_sig)
}
None => AstConv::ty_of_fn(
diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs
index 3ff79eaea49ab..2d37fdd135eee 100644
--- a/library/test/src/lib.rs
+++ b/library/test/src/lib.rs
@@ -353,12 +353,13 @@ where
}
let mut completed_test = res.unwrap();
- let running_test = running_tests.remove(&completed_test.desc).unwrap();
- if let Some(join_handle) = running_test.join_handle {
- if let Err(_) = join_handle.join() {
- if let TrOk = completed_test.result {
- completed_test.result =
- TrFailedMsg("panicked after reporting success".to_string());
+ if let Some(running_test) = running_tests.remove(&completed_test.desc) {
+ if let Some(join_handle) = running_test.join_handle {
+ if let Err(_) = join_handle.join() {
+ if let TrOk = completed_test.result {
+ completed_test.result =
+ TrFailedMsg("panicked after reporting success".to_string());
+ }
}
}
}
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 63a25e5dbfbbb..1478437cefaa3 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -16,7 +16,7 @@ use rustc_session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, E
use rustc_session::getopts;
use rustc_session::lint::Level;
use rustc_session::search_paths::SearchPath;
-use rustc_span::edition::{Edition, DEFAULT_EDITION};
+use rustc_span::edition::Edition;
use rustc_target::spec::TargetTriple;
use crate::core::new_handler;
@@ -469,17 +469,7 @@ impl Options {
}
}
- let edition = if let Some(e) = matches.opt_str("edition") {
- match e.parse() {
- Ok(e) => e,
- Err(_) => {
- diag.struct_err("could not parse edition").emit();
- return Err(1);
- }
- }
- } else {
- DEFAULT_EDITION
- };
+ let edition = config::parse_crate_edition(&matches);
let mut id_map = html::markdown::IdMap::new();
id_map.populate(&html::render::INITIAL_IDS);
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 6909ab870db61..b38fb09a1c589 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1344,7 +1344,6 @@ impl AllTypes {
\
- List of all items\
",
);
// Note: print_entries does not escape the title, because we know the current set of titles
diff --git a/src/librustdoc/html/render/tests.rs b/src/librustdoc/html/render/tests.rs
index abf5f05fe58ab..224c794fb3b4a 100644
--- a/src/librustdoc/html/render/tests.rs
+++ b/src/librustdoc/html/render/tests.rs
@@ -38,3 +38,14 @@ fn test_name_sorting() {
sorted.sort_by(|&l, r| compare_names(l, r));
assert_eq!(names, sorted);
}
+
+#[test]
+fn test_all_types_prints_header_once() {
+ // Regression test for #82477
+ let all_types = AllTypes::new();
+
+ let mut buffer = Buffer::new();
+ all_types.print(&mut buffer);
+
+ assert_eq!(1, buffer.into_inner().matches("List of all items").count());
+}
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 532a0cf932904..f0c254ede650a 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -1206,7 +1206,10 @@ impl LinkCollector<'_, '_> {
// for discussion on the matter.
verify(kind, id)?;
+ // FIXME: it would be nice to check that the feature gate was enabled in the original crate, not just ignore it altogether.
+ // However I'm not sure how to check that across crates.
if prim == PrimitiveType::RawPointer
+ && item.def_id.is_local()
&& !self.cx.tcx.features().intra_doc_pointers
{
let span = super::source_span_for_markdown_range(
diff --git a/src/llvm-project b/src/llvm-project
index 70d09f218d1c8..c6f9d6db7b0c4 160000
--- a/src/llvm-project
+++ b/src/llvm-project
@@ -1 +1 @@
-Subproject commit 70d09f218d1c84fedabdb74881e214dacd5b0c3d
+Subproject commit c6f9d6db7b0c4677d1aae8977505fe6340a3aae2
diff --git a/src/test/rustdoc-ui/intra-doc/auxiliary/pointer-reexports-allowed.rs b/src/test/rustdoc-ui/intra-doc/auxiliary/pointer-reexports-allowed.rs
new file mode 100644
index 0000000000000..0a3dc57f10241
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-doc/auxiliary/pointer-reexports-allowed.rs
@@ -0,0 +1,4 @@
+#![feature(intra_doc_pointers)]
+#![crate_name = "inner"]
+/// Link to [some pointer](*const::to_raw_parts)
+pub fn foo() {}
diff --git a/src/test/rustdoc-ui/intra-doc/pointer-reexports-allowed.rs b/src/test/rustdoc-ui/intra-doc/pointer-reexports-allowed.rs
new file mode 100644
index 0000000000000..8654a8e1bd2b4
--- /dev/null
+++ b/src/test/rustdoc-ui/intra-doc/pointer-reexports-allowed.rs
@@ -0,0 +1,4 @@
+// aux-build:pointer-reexports-allowed.rs
+// check-pass
+extern crate inner;
+pub use inner::foo;
diff --git a/src/test/ui/resolve/issue-82156.rs b/src/test/ui/resolve/issue-82156.rs
new file mode 100644
index 0000000000000..6215259e48657
--- /dev/null
+++ b/src/test/ui/resolve/issue-82156.rs
@@ -0,0 +1,3 @@
+fn main() {
+ super(); //~ ERROR failed to resolve: there are too many leading `super` keywords
+}
diff --git a/src/test/ui/resolve/issue-82156.stderr b/src/test/ui/resolve/issue-82156.stderr
new file mode 100644
index 0000000000000..d53599dcce61b
--- /dev/null
+++ b/src/test/ui/resolve/issue-82156.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve: there are too many leading `super` keywords
+ --> $DIR/issue-82156.rs:2:5
+ |
+LL | super();
+ | ^^^^^ there are too many leading `super` keywords
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.rs b/src/test/ui/typeck/typeck_type_placeholder_item.rs
index 2c8b1e76b1b82..2523362fdc4b6 100644
--- a/src/test/ui/typeck/typeck_type_placeholder_item.rs
+++ b/src/test/ui/typeck/typeck_type_placeholder_item.rs
@@ -208,3 +208,15 @@ impl Qux for Struct {
const D: _ = 42;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
}
+
+fn map(_: fn() -> Option<&'static T>) -> Option {
+ None
+}
+
+fn value() -> Option<&'static _> {
+//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
+ Option::<&'static u8>::None
+}
+
+const _: Option<_> = map(value);
+//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.stderr
index 684f451b7c3f6..1034402bfb08d 100644
--- a/src/test/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/src/test/ui/typeck/typeck_type_placeholder_item.stderr
@@ -158,7 +158,7 @@ LL | fn test11(x: &usize) -> &_ {
| -^
| ||
| |not allowed in type signatures
- | help: replace with the correct return type: `&&usize`
+ | help: replace with the correct return type: `&'static &'static usize`
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:52:52
@@ -410,6 +410,24 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
LL | type Y = impl Trait<_>;
| ^ not allowed in type signatures
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ --> $DIR/typeck_type_placeholder_item.rs:216:31
+ |
+LL | fn value() -> Option<&'static _> {
+ | ----------------^-
+ | | |
+ | | not allowed in type signatures
+ | help: replace with the correct return type: `Option<&'static u8>`
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ --> $DIR/typeck_type_placeholder_item.rs:221:10
+ |
+LL | const _: Option<_> = map(value);
+ | ^^^^^^^^^
+ | |
+ | not allowed in type signatures
+ | help: replace `_` with the correct type: `Option`
+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:140:31
|
@@ -614,7 +632,7 @@ LL | const D: _ = 42;
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
-error: aborting due to 67 previous errors
+error: aborting due to 69 previous errors
Some errors have detailed explanations: E0121, E0282, E0403.
For more information about an error, try `rustc --explain E0121`.