Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #104293

Merged
merged 58 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
6630c14
Implement the `+whole-archive` modifier for `wasm-ld`
alexcrichton Sep 24, 2022
c0447b4
fix #103435, unused lint won't produce invalid code
chenyukang Oct 24, 2022
a46af18
fix parentheses surrounding spacing issue in parser
chenyukang Oct 24, 2022
32a2f0d
suggest calling the method of the same name when method not found
chenyukang Oct 25, 2022
2716449
add testcase for suggest self
chenyukang Oct 25, 2022
4f3a988
teach ./miri how to do Josh syncs
RalfJung Oct 29, 2022
39598e4
merge rustup-toolchain into ./miri
RalfJung Oct 29, 2022
2a3a53b
explain how to go back to rustup-managed Miri
RalfJung Oct 29, 2022
18a23a5
Auto merge of #2635 - RalfJung:rustup-managed-miri, r=RalfJung
bors Oct 29, 2022
79a48ce
Auto merge of #2634 - RalfJung:miri-script, r=oli-obk
bors Oct 29, 2022
1470e99
Stacked Borrows: make scalar field retagging the default
RalfJung Oct 29, 2022
c162fd3
Auto merge of #2636 - RalfJung:scalar-field-retag, r=oli-obk
bors Oct 29, 2022
bfe23b9
Merge from rustc
RalfJung Oct 30, 2022
0b49a5d
rustup
RalfJung Oct 30, 2022
962bf63
Auto merge of #2639 - RalfJung:rustup, r=RalfJung
bors Oct 30, 2022
41c368b
fix dupe word typos
Rageking8 Oct 31, 2022
224dff4
add acquire when init once is already complete
beepster4096 Oct 31, 2022
21669d2
Auto merge of #2640 - Rageking8:fix-dupe-word-typos, r=saethlin
bors Oct 31, 2022
a1cd279
followup for pr 2640
Rageking8 Oct 31, 2022
02c5ded
Auto merge of #2642 - Rageking8:followup-for-pr-2640, r=RalfJung
bors Oct 31, 2022
9554907
fix ./miri bench
RalfJung Nov 2, 2022
9d9157e
Auto merge of #2645 - RalfJung:miri-bench, r=RalfJung
bors Nov 2, 2022
fa1b720
refactor into private functions
beepster4096 Nov 4, 2022
cb6f7a6
clarify no_data_race_after_complete test
beepster4096 Nov 4, 2022
4492c02
Auto merge of #2641 - DrMeepster:init_once_acquire, r=RalfJung
bors Nov 4, 2022
83239c2
Merge from rustc
RalfJung Nov 5, 2022
7910caf
Auto merge of #2650 - RalfJung:rustup, r=RalfJung
bors Nov 5, 2022
a1d94d4
impl condvars for windows
beepster4096 Oct 30, 2022
a2f7e84
use enum for condvar locks
beepster4096 Oct 30, 2022
2eb07a0
fix shared behavior and add tests
beepster4096 Oct 31, 2022
f60a2ae
Auto merge of #2638 - DrMeepster:windows-condvars, r=RalfJung
bors Nov 6, 2022
8e0cac1
rustdoc: refactor `notable_traits_decl` to just act on the type directly
notriddle Nov 7, 2022
303653e
rustdoc: use javascript to layout notable traits popups
notriddle Nov 7, 2022
a45151e
rustdoc: fix font color inheritance from body, and test
notriddle Nov 8, 2022
e636af7
lint auto pass
AndyJado Sep 14, 2022
a0cee0a
remove old var_span_path_only
AndyJado Nov 4, 2022
abf259c
var_subdiag refinement
AndyJado Nov 9, 2022
057d8e5
struct error E0505
AndyJado Nov 9, 2022
53e8b49
rustdoc: sort output to make it deterministic
notriddle Nov 9, 2022
5c25d30
Allow specialized const trait impls.
BGR360 Mar 25, 2022
ce03d25
Disallow specializing on const impls with non-const impls.
BGR360 Sep 14, 2022
d492b9b
Add #[const_trait] where needed in tests.
BGR360 Nov 6, 2022
c0ae62e
Require `~const` qualifier on trait bounds in specializing impls if p…
BGR360 Nov 6, 2022
fe53cac
Apply PR feedback.
BGR360 Nov 10, 2022
0f2e45b
make `Sized` coinductive
lcnr Mar 29, 2021
8ec6c84
add some more tests
lcnr Apr 27, 2021
43ad19b
bless tests
compiler-errors Aug 10, 2022
fea8d0e
More nits
compiler-errors Nov 10, 2022
94f67e6
Oops, bless this test.
BGR360 Nov 11, 2022
05824cd
rustdoc: fix HTML validation failure by escaping `data-ty`
notriddle Nov 11, 2022
cd30ccf
Rollup merge of #95292 - BGR360:const-trait-specialize, r=lcnr
Manishearth Nov 11, 2022
76ce198
Rollup merge of #100386 - compiler-errors:sized-coinductive-redux, r=…
Manishearth Nov 11, 2022
9553fea
Rollup merge of #102215 - alexcrichton:wasm-link-whole-archive, r=est…
Manishearth Nov 11, 2022
fd5ff82
Rollup merge of #103468 - chenyukang:yukang/fix-103435-extra-parenthe…
Manishearth Nov 11, 2022
f00897e
Rollup merge of #103531 - chenyukang:yukang/fix-103474, r=estebank
Manishearth Nov 11, 2022
a13809a
Rollup merge of #103960 - AndyJado:var_path_only_diag, r=davidtwco
Manishearth Nov 11, 2022
e8bc6e1
Rollup merge of #104051 - RalfJung:miri, r=RalfJung
Manishearth Nov 11, 2022
b74d042
Rollup merge of #104129 - notriddle:notriddle/102576-js-notable-trait…
Manishearth Nov 11, 2022
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
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/borrow_set.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::nll::ToRegionVid;
use crate::path_utils::allow_two_phase_borrow;
use crate::place_ext::PlaceExt;
Expand Down
13 changes: 11 additions & 2 deletions compiler/rustc_borrowck/src/borrowck_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
pub(crate) fn cannot_move_when_borrowed(
&self,
span: Span,
desc: &str,
borrow_span: Span,
place: &str,
borrow_place: &str,
value_place: &str,
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
struct_span_err!(self, span, E0505, "cannot move out of {} because it is borrowed", desc,)
self.infcx.tcx.sess.create_err(crate::session_diagnostics::MoveBorrow {
place,
span,
borrow_place,
value_place,
borrow_span,
})
}

pub(crate) fn cannot_use_when_mutably_borrowed(
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/constraint_generation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_infer::infer::InferCtxt;
use rustc_middle::mir::visit::TyContext;
use rustc_middle::mir::visit::Visitor;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_borrowck/src/constraints/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

use rustc_data_structures::graph::scc::Sccs;
use rustc_index::vec::IndexVec;
use rustc_middle::mir::ConstraintCategory;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/consumers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! This file provides API for compiler consumers.

use rustc_hir::def_id::LocalDefId;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/dataflow.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::fx::FxHashMap;
use rustc_index::bit_set::BitSet;
use rustc_middle::mir::{self, BasicBlock, Body, Location, Place};
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/def_use.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_middle::mir::visit::{
MutatingUseContext, NonMutatingUseContext, NonUseContext, PlaceContext,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed};
use rustc_infer::infer::canonical::Canonical;
use rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError;
Expand Down
51 changes: 19 additions & 32 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
}

use_spans.var_span_label_path_only(
&mut err,
format!("{} occurs due to use{}", desired_action.as_noun(), use_spans.describe()),
);
use_spans.var_path_only_subdiag(&mut err, desired_action);

if !is_loop_move {
err.span_label(
Expand Down Expand Up @@ -404,10 +401,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let used = desired_action.as_general_verb_in_past_tense();
let mut err =
struct_span_err!(self, span, E0381, "{used} binding {desc}{isnt_initialized}");
use_spans.var_span_label_path_only(
&mut err,
format!("{} occurs due to use{}", desired_action.as_noun(), use_spans.describe()),
);
use_spans.var_path_only_subdiag(&mut err, desired_action);

if let InitializationRequiringAction::PartialAssignment
| InitializationRequiringAction::Assignment = desired_action
Expand Down Expand Up @@ -673,16 +667,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let move_spans = self.move_spans(place.as_ref(), location);
let span = move_spans.args_or_use();

let mut err =
self.cannot_move_when_borrowed(span, &self.describe_any_place(place.as_ref()));
err.span_label(borrow_span, format!("borrow of {} occurs here", borrow_msg));
err.span_label(span, format!("move out of {} occurs here", value_msg));

borrow_spans.var_span_label_path_only(
&mut err,
format!("borrow occurs due to use{}", borrow_spans.describe()),
let mut err = self.cannot_move_when_borrowed(
span,
borrow_span,
&self.describe_any_place(place.as_ref()),
&borrow_msg,
&value_msg,
);

borrow_spans.var_path_only_subdiag(&mut err, crate::InitializationRequiringAction::Borrow);

move_spans.var_span_label(
&mut err,
format!("move occurs due to use{}", move_spans.describe()),
Expand Down Expand Up @@ -724,22 +718,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
borrow_span,
&self.describe_any_place(borrow.borrowed_place.as_ref()),
);
borrow_spans.var_subdiag(
&mut err,
|var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
let place = &borrow.borrowed_place;
let desc_place = self.describe_any_place(place.as_ref());
match borrow_spans {
UseSpans::ClosureUse { generator_kind, .. } => match generator_kind {
Some(_) => BorrowUsePlaceGenerator { place: desc_place, var_span },
None => BorrowUsePlaceClosure { place: desc_place, var_span },
},
_ => BorrowUsePlace { place: desc_place, var_span },
}
},
"mutable",
);
borrow_spans.var_subdiag(&mut err, Some(borrow.kind), |kind, var_span| {
use crate::session_diagnostics::CaptureVarCause::*;
let place = &borrow.borrowed_place;
let desc_place = self.describe_any_place(place.as_ref());
match kind {
Some(_) => BorrowUsePlaceGenerator { place: desc_place, var_span },
None => BorrowUsePlaceClosure { place: desc_place, var_span },
}
});

self.explain_why_borrow_contains_point(location, borrow, None)
.add_explanation_to_diagnostic(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

use std::collections::BTreeSet;

use rustc_middle::mir::visit::{PlaceContext, Visitor};
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_borrowck/src/diagnostics/find_use.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

use std::collections::VecDeque;
use std::rc::Rc;

Expand Down
64 changes: 48 additions & 16 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,34 @@ impl UseSpans<'_> {
}
}

// Add a span label to the use of the captured variable, if it exists.
// only adds label to the `path_span`
pub(super) fn var_span_label_path_only(self, err: &mut Diagnostic, message: impl Into<String>) {
if let UseSpans::ClosureUse { path_span, .. } = self {
err.span_label(path_span, message);
/// Add a span label to the use of the captured variable, if it exists.
/// only adds label to the `path_span`
pub(super) fn var_path_only_subdiag(
self,
err: &mut Diagnostic,
action: crate::InitializationRequiringAction,
) {
use crate::session_diagnostics::CaptureVarPathUseCause::*;
use crate::InitializationRequiringAction::*;
if let UseSpans::ClosureUse { generator_kind, path_span, .. } = self {
match generator_kind {
Some(_) => {
err.subdiagnostic(match action {
Borrow => BorrowInGenerator { path_span },
MatchOn | Use => UseInGenerator { path_span },
Assignment => AssignInGenerator { path_span },
PartialAssignment => AssignPartInGenerator { path_span },
});
}
None => {
err.subdiagnostic(match action {
Borrow => BorrowInClosure { path_span },
MatchOn | Use => UseInClosure { path_span },
Assignment => AssignInClosure { path_span },
PartialAssignment => AssignPartInClosure { path_span },
});
}
}
}
}

Expand Down Expand Up @@ -627,19 +650,28 @@ impl UseSpans<'_> {
pub(super) fn var_subdiag(
self,
err: &mut Diagnostic,
f: impl Fn(Span) -> crate::session_diagnostics::CaptureVarCause,
kind_desc: impl Into<String>,
kind: Option<rustc_middle::mir::BorrowKind>,
f: impl Fn(Option<GeneratorKind>, Span) -> crate::session_diagnostics::CaptureVarCause,
) {
if let UseSpans::ClosureUse { capture_kind_span, path_span, .. } = self {
if capture_kind_span == path_span {
err.subdiagnostic(f(capture_kind_span));
} else {
err.subdiagnostic(crate::session_diagnostics::CaptureVarKind {
kind_desc: kind_desc.into(),
kind_span: capture_kind_span,
use crate::session_diagnostics::CaptureVarKind::*;
if let UseSpans::ClosureUse { generator_kind, capture_kind_span, path_span, .. } = self {
if capture_kind_span != path_span {
err.subdiagnostic(match kind {
Some(kd) => match kd {
rustc_middle::mir::BorrowKind::Shared
| rustc_middle::mir::BorrowKind::Shallow
| rustc_middle::mir::BorrowKind::Unique => {
Immute { kind_span: capture_kind_span }
}

rustc_middle::mir::BorrowKind::Mut { .. } => {
Mut { kind_span: capture_kind_span }
}
},
None => Move { kind_span: capture_kind_span },
});
err.subdiagnostic(f(path_span));
}
};
err.subdiagnostic(f(generator_kind, path_span));
}
}

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_borrowck/src/diagnostics/var_name.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

use crate::Upvar;
use crate::{nll::ToRegionVid, region_infer::RegionInferenceContext};
use rustc_index::vec::{Idx, IndexVec};
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/facts.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::location::{LocationIndex, LocationTable};
use crate::BorrowIndex;
use polonius_engine::AllFacts as PoloniusFacts;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/invalidation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::graph::dominators::Dominators;
use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{self, BasicBlock, Body, Location, NonDivergingIntrinsic, Place, Rvalue};
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/location.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_index::vec::{Idx, IndexVec};
use rustc_middle::mir::{BasicBlock, Body, Location};

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/member_constraints.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxHashMap;
use rustc_index::vec::IndexVec;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/nll.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! The entry point of the NLL borrow checker.

use rustc_data_structures::vec_map::VecMap;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/path_utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation};
use crate::places_conflict;
use crate::AccessDepth;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/place_ext.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::borrow_set::LocalsStateAtExit;
use rustc_hir as hir;
use rustc_middle::mir::ProjectionElem;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/places_conflict.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::ArtificialField;
use crate::Overlap;
use crate::{AccessDepth, Deep, Shallow};
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/prefixes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! From the NLL RFC: "The deep [aka 'supporting'] prefixes for an
//! place are formed by stripping away fields and derefs, except that
//! we stop when we reach the deref of a shared reference. [...] "
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/region_infer/dump_mir.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! As part of generating the regions, if you enable `-Zdump-mir=nll`,
//! we will generate an annotated copy of the MIR that includes the
//! state of region inference. This code handles emitting the region
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/region_infer/graphviz.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! This module provides linkage between RegionInferenceContext and
//! `rustc_graphviz` traits, specialized to attaching borrowck analysis
//! data to rendered labels.
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::constraints::ConstraintSccIndex;
use crate::RegionInferenceContext;
use itertools::Itertools;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/region_infer/values.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::fx::FxIndexSet;
use rustc_index::bit_set::SparseBitMatrix;
use rustc_index::interval::IntervalSet;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_borrowck/src/renumber.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_index::vec::IndexVec;
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
use rustc_middle::mir::visit::{MutVisitor, TyContext};
Expand Down
Loading