diff --git a/compiler/rustc_expand/src/mbe/macro_parser.rs b/compiler/rustc_expand/src/mbe/macro_parser.rs index 29f354d572802..ddfbef945efaa 100644 --- a/compiler/rustc_expand/src/mbe/macro_parser.rs +++ b/compiler/rustc_expand/src/mbe/macro_parser.rs @@ -76,6 +76,7 @@ crate use ParseResult::*; use crate::mbe::{KleeneOp, TokenTree}; use rustc_ast::token::{self, DocComment, Nonterminal, NonterminalKind, Token}; +use rustc_lint_defs::pluralize; use rustc_parse::parser::{NtOrTt, Parser}; use rustc_span::symbol::MacroRulesNormalizedIdent; use rustc_span::Span; @@ -668,8 +669,7 @@ impl TtParser { self.macro_name, match self.next_mps.len() { 0 => format!("built-in NTs {}.", nts), - 1 => format!("built-in NTs {} or 1 other option.", nts), - n => format!("built-in NTs {} or {} other options.", nts, n), + n => format!("built-in NTs {} or {n} other option{s}.", nts, s = pluralize!(n)), } ), ) diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index ba0b35470b6ba..4cc3169180ea5 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -175,7 +175,7 @@ impl TTMacroExpander for MacroRulesMacroExpander { if !self.valid { return DummyResult::any(sp); } - generic_extension( + expand_macro( cx, sp, self.span, @@ -202,8 +202,9 @@ fn trace_macros_note(cx_expansions: &mut FxHashMap>, sp: Span, cx_expansions.entry(sp).or_default().push(message); } -/// Given `lhses` and `rhses`, this is the new macro we create -fn generic_extension<'cx, 'tt>( +/// Expands the rules based macro defined by `lhses` and `rhses` for a given +/// input `arg`. +fn expand_macro<'cx, 'tt>( cx: &'cx mut ExtCtxt<'_>, sp: Span, def_span: Span, diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index e1c9ecc055f6a..fe417f45e88d9 100644 --- a/compiler/rustc_save_analysis/src/dump_visitor.rs +++ b/compiler/rustc_save_analysis/src/dump_visitor.rs @@ -780,13 +780,18 @@ impl<'tcx> DumpVisitor<'tcx> { variant: &'tcx ty::VariantDef, rest: Option<&'tcx hir::Expr<'tcx>>, ) { - if let Some(struct_lit_data) = self.save_ctxt.get_expr_data(ex) { + if let Some(_ex_res_data) = self.save_ctxt.get_expr_data(ex) { if let hir::QPath::Resolved(_, path) = path { self.write_sub_paths_truncated(path); } - down_cast_data!(struct_lit_data, RefData, ex.span); + // For MyEnum::MyVariant, get_expr_data gives us MyEnum, not MyVariant. + // For recording the span's ref id, we want MyVariant. if !generated_code(ex.span) { - self.dumper.dump_ref(struct_lit_data); + let sub_span = path.last_segment_span(); + let span = self.save_ctxt.span_from_span(sub_span); + let reff = + Ref { kind: RefKind::Type, span, ref_id: id_from_def_id(variant.def_id) }; + self.dumper.dump_ref(reff); } for field in fields { diff --git a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs index 928daba0a7b39..e89a896199615 100644 --- a/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs +++ b/compiler/rustc_typeck/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs @@ -180,6 +180,15 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> { diag_expr_id: HirId, ) { debug!("mutate {assignee_place:?}; diag_expr_id={diag_expr_id:?}"); + + if assignee_place.place.base == PlaceBase::Rvalue + && assignee_place.place.projections.is_empty() + { + // Assigning to an Rvalue is illegal unless done through a dereference. We would have + // already gotten a type error, so we will just return here. + return; + } + // If the type being assigned needs dropped, then the mutation counts as a borrow // since it is essentially doing `Drop::drop(&mut x); x = new_value;`. if assignee_place.place.base_ty.needs_drop(self.tcx, self.param_env) { diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index 39f8f1d5a0ec7..6162b5c6d4c93 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -387,7 +387,7 @@ pub const fn handle_alloc_error(layout: Layout) -> ! { #[cfg(all(not(no_global_oom_handling), test))] pub use std::alloc::handle_alloc_error; -#[cfg(all(not(no_global_oom_handling), not(any(target_os = "hermit", test))))] +#[cfg(all(not(no_global_oom_handling), not(test)))] #[doc(hidden)] #[allow(unused_attributes)] #[unstable(feature = "alloc_internals", issue = "none")] diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version index 899f24fc754a1..f514a2f0bd053 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version @@ -1 +1 @@ -0.9.0 \ No newline at end of file +0.9.1 \ No newline at end of file diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index e8e5fa1799333..68f2a54ddeb05 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -417,7 +417,7 @@ pub(super) fn write_shared( )); all_sources.sort(); Ok(format!( - "var N = null;var sourcesIndex = {{}};\n{}\ncreateSourceSidebar();\n", + "var sourcesIndex = {{}};\n{}\ncreateSourceSidebar();\n", all_sources.join("\n") ) .into_bytes()) diff --git a/src/test/ui/async-await/issue-73741-type-err-drop-tracking.rs b/src/test/ui/async-await/issue-73741-type-err-drop-tracking.rs new file mode 100644 index 0000000000000..c3423ad629f16 --- /dev/null +++ b/src/test/ui/async-await/issue-73741-type-err-drop-tracking.rs @@ -0,0 +1,14 @@ +// edition:2018 +// compile-flags: -Zdrop-tracking +// Regression test for issue #73741 +// Ensures that we don't emit spurious errors when +// a type error ocurrs in an `async fn` + +async fn weird() { + 1 = 2; //~ ERROR invalid left-hand side + + let mut loop_count = 0; + async {}.await +} + +fn main() {} diff --git a/src/test/ui/async-await/issue-73741-type-err-drop-tracking.stderr b/src/test/ui/async-await/issue-73741-type-err-drop-tracking.stderr new file mode 100644 index 0000000000000..d4e3b6c3bf40d --- /dev/null +++ b/src/test/ui/async-await/issue-73741-type-err-drop-tracking.stderr @@ -0,0 +1,11 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/issue-73741-type-err-drop-tracking.rs:8:7 + | +LL | 1 = 2; + | - ^ + | | + | cannot assign to this expression + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0070`. diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js index d75884567afee..8532410a1bf3a 100644 --- a/src/tools/rustdoc-gui/tester.js +++ b/src/tools/rustdoc-gui/tester.js @@ -138,7 +138,7 @@ async function main(argv) { try { // This is more convenient that setting fields one by one. let args = [ - "--variable", "DOC_PATH", opts["doc_folder"], + "--variable", "DOC_PATH", opts["doc_folder"], "--enable-fail-on-js-error", ]; if (opts["debug"]) { debug = true;