Skip to content

Rollup of 13 pull requests #82186

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

Closed
wants to merge 137 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
949b125
Add unit tests for new lint
nahuakang Jan 27, 2021
5753614
Draft skeleton for new lint
nahuakang Jan 27, 2021
3da25ed
Rename lint
nahuakang Jan 27, 2021
8973f2c
Run cargo dev update_lints
nahuakang Jan 27, 2021
b87e189
Implement manual flatten lint
nahuakang Jan 29, 2021
7825bf3
Fix suggestions that need parens
ThibsG Jan 31, 2021
e07cd5b
Enhance manual flatten
nahuakang Feb 2, 2021
c8cb90a
Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-fro…
Manishearth Feb 3, 2021
0f5e71f
Add additional check on if arg type has iter method
nahuakang Feb 3, 2021
f2e82af
Use PrimTy in builtin type shadow lint
camsteffen Feb 2, 2021
6396b8f
Fix file names of flat_map_identity test
magurotuna Feb 3, 2021
876ffa4
Auto merge of #6669 - magurotuna:fix-test-name, r=flip1995
bors Feb 3, 2021
78ef0f2
Add additional test cases and improve span lint
nahuakang Feb 3, 2021
0767a0f
Fix/allow non_fmt_panic in clippy tests.
m-ou-se Feb 2, 2021
9f7f8b7
Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.
m-ou-se Feb 3, 2021
2f8a8d3
Improve lint message; add note for future autofixable updates
nahuakang Feb 4, 2021
357c6a7
Auto merge of #6646 - nahuakang:for_loops_over_options_or_results, r=…
bors Feb 4, 2021
233fe11
Set turbofish for every sugg and add more test cases
ThibsG Feb 4, 2021
7b7e3ca
Support free functions in disallowed-methods lint
phlip9 Jan 30, 2021
67d48e1
fix typo
TaKO8Ki Feb 5, 2021
79dbf10
Use absolute path to Rust repo in ra_setup
flip1995 Feb 5, 2021
56f7fbb
Cleanup path to local checks
camsteffen Feb 2, 2021
89f266a
Auto merge of #6678 - TaKO8Ki:fix-typo, r=flip1995
bors Feb 5, 2021
a507c27
Auto merge of #6679 - flip1995:ra_setup_abs_path, r=Manishearth
bors Feb 5, 2021
eb9c669
First version of the lint
1c3t3a Dec 20, 2020
f907986
Added documentation
1c3t3a Dec 21, 2020
55bfaa1
Fixed macro edge case for `semicolon_if_nothing_returned lint`
1c3t3a Feb 5, 2021
ac5e9c8
Fix let_underscore_drop implements Drop logic
camsteffen Feb 5, 2021
a9ad492
Bump clippy version
Mark-Simulacrum Feb 5, 2021
93daf27
tests: ignore check_that_clippy_has_the_same_major_version_as_rustc()…
matthiaskrgr Feb 5, 2021
a60c143
Add new lint `filter_map_identity`
magurotuna Feb 3, 2021
fbe436b
Use flatten instead of filter_map
magurotuna Feb 6, 2021
cb30219
lintcheck: update logs
matthiaskrgr Feb 6, 2021
64982cc
lintcheck: make TomlCrate also accept git-data from lintcheck_crates.…
matthiaskrgr Feb 5, 2021
10fbafa
implement the download_and_extract() step for git sources
matthiaskrgr Feb 6, 2021
9ab505a
lintcheck: add git source as an example and update logs
matthiaskrgr Feb 6, 2021
e1c284b
lintcheck: cleanup, fix --only for git crates, better error msgs
matthiaskrgr Feb 6, 2021
6626295
Fixed for loop problem, corrected all occurences that got linted
1c3t3a Feb 6, 2021
dfb34c0
Auto merge of #6684 - matthiaskrgr:versiontest_dont_break_upstream, r…
bors Feb 6, 2021
cd67487
Revert "Fixed for loop problem, corrected all occurences that got lin…
1c3t3a Feb 6, 2021
85c2b1e
Switched to `snippet_with_macro_callsite`
1c3t3a Feb 6, 2021
a5d442c
Rollup merge of #81680 - camsteffen:primty, r=oli-obk
jonas-schievink Feb 6, 2021
f1c1584
Changed lint level to `restriction`
1c3t3a Feb 6, 2021
915e9b8
Fix cargo_common_metadata warning on `publish = false`.
daxpedda Jan 29, 2021
d4bc7d2
Test names were flipped.
daxpedda Feb 3, 2021
f0d3fd7
Implement `_cargo_ignore_publish`.
daxpedda Feb 3, 2021
8805931
Hide clippy configuration option.
daxpedda Feb 6, 2021
f2391a5
Change clippy configuration option.
daxpedda Feb 6, 2021
8b89087
Add test for `publish = true`.
daxpedda Feb 6, 2021
cd361a5
Add back `publish = false` to the old test.
daxpedda Feb 6, 2021
e2e33b4
Pick up `clippy.toml` in `ui-cargo` tests.
daxpedda Feb 6, 2021
3c8f754
Fux `toml_unknown_key` test.
daxpedda Feb 6, 2021
ea0b832
Document condition.
daxpedda Feb 6, 2021
fd8b5fa
Confused about my own explanation.
daxpedda Feb 6, 2021
2bffbfc
lintcheck: avoid dbg!() calls
matthiaskrgr Feb 6, 2021
0585c34
Stabilize workspace wrapper.
ehuss Feb 6, 2021
6b4789d
Fixed suggestion in macro invocations
1c3t3a Feb 6, 2021
40ce056
Eat dogfood
camsteffen Feb 5, 2021
dfe08f4
Update triagebot.toml to new label names
flip1995 Feb 6, 2021
d792210
Auto merge of #6682 - camsteffen:let-underscore-ref, r=llogiq
bors Feb 7, 2021
b36d1a4
Auto merge of #6688 - rust-lang:triagebot_update, r=phansch
bors Feb 7, 2021
d51db24
Auto merge of #6660 - camsteffen:path-to-local, r=llogiq
bors Feb 7, 2021
001185d
Auto merge of #6681 - 1c3t3a:1c3t3a-issue-6467, r=xFrednet,flip1995,p…
bors Feb 7, 2021
ad9ceee
Auto merge of #6685 - magurotuna:filter_map_identity, r=phansch
bors Feb 7, 2021
83b7b16
Auto merge of #6674 - phlip9:disallowed_functions, r=llogiq
bors Feb 7, 2021
c1ce78f
Auto merge of #6686 - matthiaskrgr:lintcheck_git, r=flip1995
bors Feb 7, 2021
6f3eeac
lintcheck: add a cmdline option --crates-toml <TOML PATH> to override…
matthiaskrgr Feb 7, 2021
1c3033d
add a new lint `bytes_nth`
TaKO8Ki Feb 7, 2021
de35c29
Auto merge of #6694 - matthiaskrgr:lintcheck-cfg, r=Manishearth
bors Feb 7, 2021
7e94641
Fix SourceMap::start_point
osa1 Feb 7, 2021
fd35517
Downgrade trivial_regex to nursery
dtolnay Feb 8, 2021
4bbd7e4
Auto merge of #6696 - dtolnay-contrib:regex, r=Manishearth
bors Feb 8, 2021
1d30422
Enhance LocalUsedVisitor to check closure bodies
camsteffen Feb 3, 2021
5db48a3
Refactor out UnusedSelfVisitor
camsteffen Feb 3, 2021
37555f8
Use path_to_local_id
camsteffen Feb 8, 2021
34b373d
Rename HIR UnOp variants
osa1 Feb 9, 2021
775ce47
Rename "good first issue" back to "good-first-issue"
flip1995 Feb 9, 2021
03a0dd5
Auto merge of #6704 - rust-lang:flip1995-patch-1, r=phansch
bors Feb 9, 2021
b932587
Add better turbofish extractor
ThibsG Feb 9, 2021
03737e2
Remove rustfmt from rust-toolchain file
flip1995 Feb 9, 2021
08b4d50
Auto merge of #6709 - rust-lang:flip1995-patch-1, r=matthiaskrgr
bors Feb 9, 2021
0e371b8
Auto merge of #6698 - camsteffen:path-to-local, r=phansch
bors Feb 10, 2021
932cc08
Update clippy_lints/src/methods/bytes_nth.rs
TaKO8Ki Feb 10, 2021
5996ae1
add some test cases
TaKO8Ki Feb 10, 2021
9c0ae2a
Auto merge of #6687 - ehuss:stabilize-wrapper, r=flip1995
bors Feb 10, 2021
b5e4389
Auto merge of #6695 - TaKO8Ki:add-bytes-nth, r=phansch
bors Feb 10, 2021
94b8f23
Fix typo
alpaca-tc Feb 10, 2021
a6d6b1b
Auto merge of #6714 - alpaca-tc:fixed_tiny_typo, r=flip1995
bors Feb 10, 2021
3784cdf
Auto merge of #6657 - ThibsG:FromIterParens, r=llogiq
bors Feb 10, 2021
beb49ba
Auto merge of #6650 - daxpedda:cargo-common-metadata-publish, r=flip1995
bors Feb 11, 2021
1025cd3
lintcheck toml: explain why tokei is commented out
matthiaskrgr Feb 9, 2021
c7241b6
lintcheck: make the log file be ${source-file}-logs.txt
matthiaskrgr Feb 9, 2021
cfe154b
start a clippy-dev readme and some rough info on how to use lintcheck
matthiaskrgr Feb 9, 2021
5e29aa6
lintcheck: add support for path sources
matthiaskrgr Feb 10, 2021
a6d493d
lintcheck: collect ICEs
matthiaskrgr Feb 10, 2021
8dbcffe
Auto merge of #6708 - matthiaskrgr:lintcheck, r=flip1995
bors Feb 11, 2021
00f9981
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Feb 11, 2021
4efc454
Bump nightly version -> 2021-02-11
flip1995 Feb 11, 2021
70c0f90
Auto merge of #6718 - flip1995:rustup, r=flip1995
bors Feb 11, 2021
d2e2f64
Merge commit '70c0f90453701e7d6d9b99aaa1fc6a765937b736' into clippyup
flip1995 Feb 11, 2021
dfa581f
Fix pretty printing of generic associated type constraints
matthewjasper Feb 11, 2021
9bbd3e0
Remove ProjectionTy::from_ref_and_name
matthewjasper Feb 11, 2021
0bf1d73
Don't go through TraitRef to relate projections
matthewjasper Feb 12, 2021
9526c0c
Avoid `trait_ref` when lowering ExistentialProjections
matthewjasper Feb 12, 2021
79f6f11
Remove some unnecessary `trait_ref` calls
matthewjasper Feb 12, 2021
dfee89f
Make ProjectionTy::trait_ref truncate substs again
matthewjasper Feb 12, 2021
d785c8c
Remove unnecessary function parameters project.rs
matthewjasper Feb 12, 2021
eeb82e4
Add more tests for generic associated type bounds
matthewjasper Feb 12, 2021
845c14d
Simpler way to convert to digit
gilescope Feb 14, 2021
3e305f6
Deprecate items that accidentally weren't deprecated
bstrie Feb 14, 2021
17e238d
Use wrapping sub
gilescope Feb 15, 2021
d2ba68b
Update methods.rs
gilescope Feb 15, 2021
719c8d4
Fix ES5 errors (IE11)
GuillaumeGomez Feb 15, 2021
c914952
Move some tests to more reasonable directories
c410-f3r Feb 15, 2021
f2f7ffe
Fix typo in rustc_infer::infer::UndoLog
pierwill Feb 15, 2021
aee1e59
Simplify pattern grammar by allowing nested leading vert
mark-i-m Feb 8, 2021
8192793
Add long explanation for E0545
jesusprubio Feb 15, 2021
4390a61
avoid full-slicing slices
matthiaskrgr Feb 15, 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
897cb61
validation: fix invalid-fn-ptr error message
RalfJung Feb 16, 2021
e5514ef
add test
RalfJung Feb 16, 2021
cc408a4
Rollup merge of #81860 - osa1:issue81800, r=estebank
Dylan-DPC Feb 16, 2021
359bd0e
Rollup merge of #81869 - mark-i-m:leading-vert, r=petrochenkov
Dylan-DPC Feb 16, 2021
5734d13
Rollup merge of #81941 - c410-f3r:tests-tests-tests, r=petrochenkov
Dylan-DPC Feb 16, 2021
5e228f1
Rollup merge of #81993 - flip1995:clippyup, r=Manishearth
Dylan-DPC Feb 16, 2021
5cb3ffe
Rollup merge of #82007 - sexxi-goose:reborrow, r=nikomatsakis
Dylan-DPC Feb 16, 2021
bbcde47
Rollup merge of #82066 - matthewjasper:trait-ref-fix, r=jackh726
Dylan-DPC Feb 16, 2021
74cf296
Rollup merge of #82094 - gilescope:to_digit_speedup2, r=m-ou-se
Dylan-DPC Feb 16, 2021
7153a9e
Rollup merge of #82122 - bstrie:dep4real, r=dtolnay
Dylan-DPC Feb 16, 2021
5946f0b
Rollup merge of #82145 - GuillaumeGomez:es5-checks, r=Nemo157
Dylan-DPC Feb 16, 2021
0f8249d
Rollup merge of #82160 - pierwill:patch-2, r=lcnr
Dylan-DPC Feb 16, 2021
1f2c806
Rollup merge of #82161 - jesusprubio:add-long-explanation-e0545, r=Gu…
Dylan-DPC Feb 16, 2021
fcbf20b
Rollup merge of #82163 - matthiaskrgr:slice, r=jyn514
Dylan-DPC Feb 16, 2021
ae8090b
Rollup merge of #82175 - RalfJung:invalid-fn-ptr, r=oli-obk
Dylan-DPC Feb 16, 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
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl<'hir> LoweringContext<'_, 'hir> {

let parent_generics = match self.items.get(&parent_hir_id).unwrap().kind {
hir::ItemKind::Impl(hir::Impl { ref generics, .. })
| hir::ItemKind::Trait(_, _, ref generics, ..) => &generics.params[..],
| hir::ItemKind::Trait(_, _, ref generics, ..) => generics.params,
_ => &[],
};
let lt_def_names = parent_generics.iter().filter_map(|param| match param.kind {
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ impl<'a> State<'a> {

pub fn print_assoc_constraint(&mut self, constraint: &ast::AssocTyConstraint) {
self.print_ident(constraint.ident);
constraint.gen_args.as_ref().map(|args| self.print_generic_args(args, false));
self.s.space();
match &constraint.kind {
ast::AssocTyConstraintKind::Equality { ty } => {
Expand Down Expand Up @@ -1681,7 +1682,7 @@ impl<'a> State<'a> {
self.ibox(INDENT_UNIT);
self.s.word("[");
self.print_inner_attributes_inline(attrs);
self.commasep_exprs(Inconsistent, &exprs[..]);
self.commasep_exprs(Inconsistent, exprs);
self.s.word("]");
self.end();
}
Expand Down Expand Up @@ -1722,7 +1723,7 @@ impl<'a> State<'a> {
self.print_inner_attributes_inline(attrs);
self.commasep_cmnt(
Consistent,
&fields[..],
fields,
|s, field| {
s.print_outer_attributes(&field.attrs);
s.ibox(INDENT_UNIT);
Expand Down Expand Up @@ -1757,7 +1758,7 @@ impl<'a> State<'a> {
fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>], attrs: &[ast::Attribute]) {
self.popen();
self.print_inner_attributes_inline(attrs);
self.commasep_exprs(Inconsistent, &exprs[..]);
self.commasep_exprs(Inconsistent, exprs);
if exprs.len() == 1 {
self.s.word(",");
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl<'a, 'b> Context<'a, 'b> {
parse::ArgumentNamed(s) => Named(s),
};

let ty = Placeholder(match &arg.format.ty[..] {
let ty = Placeholder(match arg.format.ty {
"" => "Display",
"?" => "Debug",
"e" => "LowerExp",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/format_foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ pub mod printf {
return Some((Substitution::Escape, &s[start + 2..]));
}

Cur::new_at(&s[..], start)
Cur::new_at(s, start)
};

// This is meant to be a translation of the following regex:
Expand Down Expand Up @@ -673,7 +673,7 @@ pub mod shell {
_ => { /* fall-through */ }
}

Cur::new_at(&s[..], start)
Cur::new_at(s, start)
};

let at = at.at_next_cp()?;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let (tup, args) = args.split_last().unwrap();
(args, Some(tup))
} else {
(&args[..], None)
(args, None)
};

'make_args: for (i, arg) in first_args.iter().enumerate() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ E0538: include_str!("./error_codes/E0538.md"),
E0539: include_str!("./error_codes/E0539.md"),
E0541: include_str!("./error_codes/E0541.md"),
E0542: include_str!("./error_codes/E0542.md"),
E0545: include_str!("./error_codes/E0545.md"),
E0546: include_str!("./error_codes/E0546.md"),
E0547: include_str!("./error_codes/E0547.md"),
E0550: include_str!("./error_codes/E0550.md"),
Expand Down Expand Up @@ -606,7 +607,6 @@ E0781: include_str!("./error_codes/E0781.md"),
// E0540, // multiple rustc_deprecated attributes
E0543, // missing 'reason'
E0544, // multiple stability levels
E0545, // incorrect 'issue'
// E0548, // replaced with a generic attribute input check
// rustc_deprecated attribute must be paired with either stable or unstable
// attribute
Expand Down
35 changes: 35 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0545.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
The `issue` value is incorrect in a stability attribute.

Erroneous code example:

```compile_fail,E0545
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "test")]

#[unstable(feature = "_unstable_fn", issue = "0")] // invalid
fn _unstable_fn() {}

#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "0")] // invalid
fn _unstable_const_fn() {}
```

To fix this issue, you need to provide a correct value in the `issue` field.
Example:

```
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "test")]

#[unstable(feature = "_unstable_fn", issue = "none")] // ok!
fn _unstable_fn() {}

#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "1")] // ok!
fn _unstable_const_fn() {}
```

See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
of the Book and the [Stability attributes][stability-attributes] section of the
Rustc Dev Guide for more details.

[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html
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
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ language_item_table! {

Deref, sym::deref, deref_trait, Target::Trait;
DerefMut, sym::deref_mut, deref_mut_trait, Target::Trait;
DerefTarget, sym::deref_target, deref_target, Target::AssocTy;
Receiver, sym::receiver, receiver_trait, Target::Trait;

Fn, kw::Fn, fn_trait, Target::Trait;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ impl<'a> State<'a> {
&f.decl,
None,
&f.generic_params,
&f.param_names[..],
f.param_names,
);
}
hir::TyKind::OpaqueDef(..) => self.s.word("/*impl Trait*/"),
Expand Down Expand Up @@ -1200,7 +1200,7 @@ impl<'a> State<'a> {
self.s.word("{");
self.commasep_cmnt(
Consistent,
&fields[..],
fields,
|s, field| {
s.ibox(INDENT_UNIT);
if !field.is_shorthand {
Expand Down
25 changes: 24 additions & 1 deletion compiler/rustc_infer/src/infer/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {

pub trait ToTrace<'tcx>: Relate<'tcx> + Copy {
fn to_trace(
tcx: TyCtxt<'tcx>,
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
Expand Down Expand Up @@ -178,7 +179,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
where
T: ToTrace<'tcx>,
{
let trace = ToTrace::to_trace(self.cause, a_is_expected, a, b);
let trace = ToTrace::to_trace(self.infcx.tcx, self.cause, a_is_expected, a, b);
Trace { at: self, trace, a_is_expected }
}
}
Expand Down Expand Up @@ -251,6 +252,7 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {

impl<'tcx> ToTrace<'tcx> for Ty<'tcx> {
fn to_trace(
_: TyCtxt<'tcx>,
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
Expand All @@ -262,6 +264,7 @@ impl<'tcx> ToTrace<'tcx> for Ty<'tcx> {

impl<'tcx> ToTrace<'tcx> for ty::Region<'tcx> {
fn to_trace(
_: TyCtxt<'tcx>,
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
Expand All @@ -273,6 +276,7 @@ impl<'tcx> ToTrace<'tcx> for ty::Region<'tcx> {

impl<'tcx> ToTrace<'tcx> for &'tcx Const<'tcx> {
fn to_trace(
_: TyCtxt<'tcx>,
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
Expand All @@ -284,6 +288,7 @@ impl<'tcx> ToTrace<'tcx> for &'tcx Const<'tcx> {

impl<'tcx> ToTrace<'tcx> for ty::TraitRef<'tcx> {
fn to_trace(
_: TyCtxt<'tcx>,
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
Expand All @@ -298,6 +303,7 @@ impl<'tcx> ToTrace<'tcx> for ty::TraitRef<'tcx> {

impl<'tcx> ToTrace<'tcx> for ty::PolyTraitRef<'tcx> {
fn to_trace(
_: TyCtxt<'tcx>,
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
Expand All @@ -309,3 +315,20 @@ impl<'tcx> ToTrace<'tcx> for ty::PolyTraitRef<'tcx> {
}
}
}

impl<'tcx> ToTrace<'tcx> for ty::ProjectionTy<'tcx> {
fn to_trace(
tcx: TyCtxt<'tcx>,
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
b: Self,
) -> TypeTrace<'tcx> {
let a_ty = tcx.mk_projection(a.item_def_id, a.substs);
let b_ty = tcx.mk_projection(b.item_def_id, b.substs);
TypeTrace {
cause: cause.clone(),
values: Types(ExpectedFound::new(a_is_expected, a_ty, b_ty)),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
if !impl_candidates.is_empty() && e.span.contains(span) {
if let Some(expr) = exprs.first() {
if let ExprKind::Path(hir::QPath::Resolved(_, path)) = expr.kind {
if let [path_segment] = &path.segments[..] {
if let [path_segment] = path.segments {
let candidate_len = impl_candidates.len();
let suggestions = impl_candidates.iter().map(|candidate| {
format!(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/undo_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Snapshot<'tcx> {
_marker: PhantomData<&'tcx ()>,
}

/// Records the 'undo' data fora single operation that affects some form of inference variable.
/// Records the "undo" data for a single operation that affects some form of inference variable.
pub(crate) enum UndoLog<'tcx> {
TypeVariables(type_variable::UndoLog<'tcx>),
ConstUnificationTable(sv::UndoLog<ut::Delegate<ty::ConstVid<'tcx>>>),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ impl EncodeContext<'a, 'tcx> {

fn encode_variances_of(&mut self, def_id: DefId) {
debug!("EncodeContext::encode_variances_of({:?})", def_id);
record!(self.tables.variances[def_id] <- &self.tcx.variances_of(def_id)[..]);
record!(self.tables.variances[def_id] <- self.tcx.variances_of(def_id));
}

fn encode_item_type(&mut self, def_id: DefId) {
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,22 +854,22 @@ impl<'hir> Map<'hir> {
/// corresponding to the node-ID.
pub fn attrs(&self, id: HirId) -> &'hir [ast::Attribute] {
self.find_entry(id).map_or(&[], |entry| match entry.node {
Node::Param(a) => &a.attrs[..],
Node::Param(a) => a.attrs,
Node::Local(l) => &l.attrs[..],
Node::Item(i) => &i.attrs[..],
Node::ForeignItem(fi) => &fi.attrs[..],
Node::TraitItem(ref ti) => &ti.attrs[..],
Node::ImplItem(ref ii) => &ii.attrs[..],
Node::Variant(ref v) => &v.attrs[..],
Node::Field(ref f) => &f.attrs[..],
Node::Item(i) => i.attrs,
Node::ForeignItem(fi) => fi.attrs,
Node::TraitItem(ref ti) => ti.attrs,
Node::ImplItem(ref ii) => ii.attrs,
Node::Variant(ref v) => v.attrs,
Node::Field(ref f) => f.attrs,
Node::Expr(ref e) => &*e.attrs,
Node::Stmt(ref s) => s.kind.attrs(|id| self.item(id.id)),
Node::Arm(ref a) => &*a.attrs,
Node::GenericParam(param) => &param.attrs[..],
Node::GenericParam(param) => param.attrs,
// Unit/tuple structs/variants take the attributes straight from
// the struct/variant definition.
Node::Ctor(..) => self.attrs(self.get_parent_item(id)),
Node::Crate(item) => &item.attrs[..],
Node::Crate(item) => item.attrs,
Node::MacroDef(def) => def.attrs,
Node::AnonConst(..)
| Node::PathSegment(..)
Expand Down
Loading