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 #82241

Merged
merged 30 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7e94641
Fix SourceMap::start_point
osa1 Feb 7, 2021
1eb79f3
Use longer lifetime in `try_report_from_nll` return type
matthewjasper Feb 9, 2021
638980a
Using tracing macros in placeholder_error.rs
matthewjasper Feb 9, 2021
c2066cf
Remove unnecessary note on errors
matthewjasper Feb 9, 2021
daab6db
Avoid repeating self type in placeholder error
matthewjasper Feb 9, 2021
94c11df
Report "nice" placeholder errors more often
matthewjasper Feb 9, 2021
9337d4f
Print closure signatures when reporting placeholder errors
matthewjasper Feb 9, 2021
615fd14
Set the kind for local variables created by &str and slice arguments …
nanguye Feb 8, 2021
f852160
Keep existing names of regions in placeholder_error
matthewjasper Feb 10, 2021
05704ec
add testcase for issue 78600
csmoe Feb 12, 2021
ed40b95
spell out nested self type
csmoe Feb 12, 2021
5385a3d
spell the real selftype
csmoe Feb 13, 2021
aee1e59
Simplify pattern grammar by allowing nested leading vert
mark-i-m Feb 8, 2021
b86c5db
Implement reborrow for closure captures
arora-aman Feb 4, 2021
e39c3c0
Handle restricting closure origin
arora-aman Feb 9, 2021
1b86ad8
Treat read of COpy types via refs as not move in move-closure
arora-aman Feb 12, 2021
f99e152
Use iter::position in truncate_capture_for_move
arora-aman Feb 13, 2021
f688bee
Add a `Result::ok_or_err` method to extract a `T` from `Result<T, T>`
thomcc Jan 1, 2021
7d30366
Fix doc link for slice::binary_search
thomcc Jan 1, 2021
2711b01
Rename Result::ok_or_err to Result::into_ok_or_err
thomcc Feb 17, 2021
404da0b
Add link to tracking issue #82223
thomcc Feb 17, 2021
fa23ddf
Expose force_quotes on Windows.
lygstate Oct 8, 2020
db59950
Rollup merge of #77728 - lygstate:master, r=Amanieu
Dylan-DPC Feb 17, 2021
40e3af5
Rollup merge of #80572 - thomcc:ok_or_err, r=m-ou-se
Dylan-DPC Feb 17, 2021
d223250
Rollup merge of #81860 - osa1:issue81800, r=estebank
Dylan-DPC Feb 17, 2021
91e5384
Rollup merge of #81869 - mark-i-m:leading-vert, r=petrochenkov
Dylan-DPC Feb 17, 2021
f79be2c
Rollup merge of #81898 - nanguye2496:nanguye2496/fix_str_and_slice_vi…
Dylan-DPC Feb 17, 2021
cdd93fd
Rollup merge of #81972 - matthewjasper:hrtb-error-cleanup, r=nikomats…
Dylan-DPC Feb 17, 2021
0b2f2b9
Rollup merge of #82007 - sexxi-goose:reborrow, r=nikomatsakis
Dylan-DPC Feb 17, 2021
f7501b6
Rollup merge of #82021 - csmoe:issue-78600, r=tmandry
Dylan-DPC Feb 17, 2021
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
30 changes: 25 additions & 5 deletions compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
) -> Option<IndexVec<mir::Local, Vec<PerLocalVarDebugInfo<'tcx, Bx::DIVariable>>>> {
let full_debug_info = self.cx.sess().opts.debuginfo == DebugInfo::Full;

let target_is_msvc = self.cx.sess().target.is_like_msvc;

if !full_debug_info && self.cx.sess().fewer_names() {
return None;
}
Expand All @@ -341,11 +343,29 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
&& var.source_info.scope == mir::OUTERMOST_SOURCE_SCOPE
{
let arg_index = place.local.index() - 1;

// FIXME(eddyb) shouldn't `ArgumentVariable` indices be
// offset in closures to account for the hidden environment?
// Also, is this `+ 1` needed at all?
VariableKind::ArgumentVariable(arg_index + 1)
if target_is_msvc {
// Rust compiler decomposes every &str or slice argument into two components:
// a pointer to the memory address where the data is stored and a usize representing
// the length of the str (or slice). These components will later be used to reconstruct
// the original argument inside the body of the function that owns it (see the
// definition of debug_introduce_local for more details).
//
// Since the original argument is declared inside a function rather than being passed
// in as an argument, it must be marked as a LocalVariable for MSVC debuggers to visualize
// its data correctly. (See issue #81894 for an in-depth description of the problem).
match *var_ty.kind() {
ty::Ref(_, inner_type, _) => match *inner_type.kind() {
ty::Slice(_) | ty::Str => VariableKind::LocalVariable,
_ => VariableKind::ArgumentVariable(arg_index + 1),
},
_ => VariableKind::ArgumentVariable(arg_index + 1),
}
} else {
// FIXME(eddyb) shouldn't `ArgumentVariable` indices be
// offset in closures to account for the hidden environment?
// Also, is this `+ 1` needed at all?
VariableKind::ArgumentVariable(arg_index + 1)
}
} else {
VariableKind::LocalVariable
};
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{Applicability, PResult};
use rustc_feature::Features;
use rustc_parse::parser::{AttemptLocalParseRecovery, ForceCollect, Parser};
use rustc_parse::parser::{AttemptLocalParseRecovery, ForceCollect, GateOr, Parser, RecoverComma};
use rustc_parse::validate_attr;
use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS;
use rustc_session::lint::BuiltinLintDiagnostics;
Expand Down Expand Up @@ -914,7 +914,9 @@ pub fn parse_ast_fragment<'a>(
}
}
AstFragmentKind::Ty => AstFragment::Ty(this.parse_ty()?),
AstFragmentKind::Pat => AstFragment::Pat(this.parse_pat(None)?),
AstFragmentKind::Pat => {
AstFragment::Pat(this.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No)?)
}
AstFragmentKind::Arms
| AstFragmentKind::Fields
| AstFragmentKind::FieldPats
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx> {
self.infcx.tcx
}

pub fn try_report_from_nll(&self) -> Option<DiagnosticBuilder<'cx>> {
pub fn try_report_from_nll(&self) -> Option<DiagnosticBuilder<'tcx>> {
// Due to the improved diagnostics returned by the MIR borrow checker, only a subset of
// the nice region errors are required when running under the MIR borrow checker.
self.try_report_named_anon_conflict().or_else(|| self.try_report_placeholder_conflict())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::ty;
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// When given a `ConcreteFailure` for a function with parameters containing a named region and
/// an anonymous region, emit an descriptive diagnostic error.
pub(super) fn try_report_named_anon_conflict(&self) -> Option<DiagnosticBuilder<'a>> {
pub(super) fn try_report_named_anon_conflict(&self) -> Option<DiagnosticBuilder<'tcx>> {
let (span, sub, sup) = self.regions()?;

debug!(
Expand Down
Loading