Skip to content

Rollup of 13 pull requests #98723

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 206 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
430575b
add `manual_find` lint for function return case
ebobrow Apr 6, 2022
5a70d88
add vec.capacity() to slow_vec_initialization
DevAccentor Jun 5, 2022
63d1c86
[core] add Exclusive to sync
guswynn Jun 1, 2022
6d6c63e
Lint single_match with Options, Results, and Cows
botahamec Jun 9, 2022
2967127
Refactored the candidate type checking
botahamec Jun 9, 2022
b46f1c4
Don't trigger if a binding is in the else pattern
botahamec Jun 10, 2022
b0c2030
Some refactoring
botahamec Jun 10, 2022
01c75e4
Added tests for Cow and Result
botahamec Jun 10, 2022
f3dc7ae
Fixed up the documentation for a couple functions
botahamec Jun 10, 2022
ded2bb5
Slight documentation change
botahamec Jun 10, 2022
9306e9a
Ignore bodies containing `todo!()` in `clippy::if_same_then_else`
May 18, 2022
7cb4cef
feat(fix): ignore todo! and unimplemented! in if_same_then_else
kyoto7250 Jun 16, 2022
922ff84
bless clippy tests
klensy Jun 15, 2022
4d88993
bless clippy ui tests
WaffleLapkin Jun 16, 2022
f8f9d01
Merge commit 'd7b5cbf065b88830ca519adcb73fad4c0d24b1c7' into clippyup
flip1995 Jun 16, 2022
f095f80
Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`
WaffleLapkin Jun 16, 2022
a5b6d25
use get_diagnostic_name for checking macro_call
kyoto7250 Jun 17, 2022
72c73f8
remove the rest of unnecessary `to_string`
TaKO8Ki Jun 17, 2022
51e2d6a
Rollup merge of #97798 - WaffleLapkin:allow_for_suggestions_that_are_…
Dylan-DPC Jun 17, 2022
2cc798b
Rollup merge of #98191 - TaKO8Ki:remove-rest-of-unnecessary-to-string…
Dylan-DPC Jun 17, 2022
2bb8c45
feat(lint): add default_iter_empty
kyoto7250 Jun 12, 2022
697c75e
check only the end
kyoto7250 Jun 17, 2022
09c9301
Auto merge of #97892 - klensy:fix-spaces, r=oli-obk
bors Jun 17, 2022
e933bb6
Auto merge of #8989 - kyoto7250:default_iter_empty, r=Alexendoo
bors Jun 17, 2022
f411c18
check macro_backtrace only
kyoto7250 Jun 18, 2022
7a83809
check only first statement
kyoto7250 Jun 18, 2022
040d45e
check macro in eq_block
kyoto7250 Jun 18, 2022
4a02ae9
cargo dev fmt
kyoto7250 Jun 18, 2022
a9215d9
ignore item in thread_local!
kyoto7250 Jun 16, 2022
eeedf72
Use RefCell in needless_return tests
Alexendoo Jun 18, 2022
4737e9e
Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-se
matthiaskrgr Jun 18, 2022
4e7ed42
Add description meta tag for lint list
unvalley Jun 19, 2022
9395c26
remove `span_lint_and_sugg_for_edges` from clippy utils
WaffleLapkin Jun 19, 2022
ee37029
remove last use of MAX_SUGGESTION_HIGHLIGHT_LINES
WaffleLapkin Jun 19, 2022
9d92af7
Auto merge of #9016 - Alexendoo:needless-return-test, r=giraffate
bors Jun 20, 2022
46d056e
check last statement
kyoto7250 Jun 20, 2022
39ffda0
check macro in HitEqInterExpr
kyoto7250 Jun 20, 2022
4a4b5cf
confirm using chain in collapsible_span_lint_calls
kyoto7250 Jun 20, 2022
195f2cb
Auto merge of #9023 - unvalley:add-meta-tag-for-lint-list, r=xFrednet
bors Jun 20, 2022
a0b107b
unused_async: lint async methods
Alexendoo Jun 20, 2022
97d4513
Auto merge of #9025 - Alexendoo:unused-async-method, r=dswij
bors Jun 20, 2022
93c6f9e
Auto merge of #9006 - kyoto7250:issue-8836-v2, r=Jarcho
bors Jun 20, 2022
6fc84d4
put parentheses around neg_multiply suggestion if needed
hellow554 Jun 20, 2022
2476100
Add details about significant drop in match scrutinees causing deadlocks
PrestonFrom Jun 10, 2022
dc7f227
`For` example should be used instead `while` in WHILE_LET_ON_ITERATOR
alex-semenyuk Jun 18, 2022
2bd1581
Add `dev deprecate`
Serial-ATA May 22, 2022
890fd0e
Remove `cargo_dev` dependency
Serial-ATA Jun 21, 2022
e5ebd3e
Implement manual_rem_euclid lint
Jun 21, 2022
6e1df47
Fix case where suggestion errored for infer type
Jun 21, 2022
ab645bb
enum_variant_names should ignore when all prefixes are _
kyoto7250 Jun 21, 2022
bc0bf06
Auto merge of #9017 - alex-semenyuk:while_let_on_iterator_doc_fix, r=…
bors Jun 22, 2022
f9fea17
Auto merge of #9030 - Serial-ATA:remove-clippy-dev-dep, r=flip1995
bors Jun 22, 2022
b969326
Example for VEC_RESIZE_TO_ZERO
alex-semenyuk Jun 22, 2022
75ed0c9
Prefer `.ok()?` over `.unwrap()`
Jun 22, 2022
93e41d3
Fix case where rem was considered commutative
Jun 22, 2022
c8df6d6
Prefer if let chain over macro
Jun 22, 2022
90f8277
Fix case for function params
Jun 22, 2022
61e1870
Add MSRV check for const rem_euclid
Jun 22, 2022
0447cc7
Simplify with let else
Jun 22, 2022
3d366fc
Auto merge of #9026 - hellow554:neg_multiply_precedence, r=xFrednet
bors Jun 22, 2022
6985e65
Auto merge of #9028 - kyoto7250:issue_8798, r=xFrednet
bors Jun 22, 2022
2cc5211
Auto merge of #9034 - alex-semenyuk:example_vec_resize_to_zero, r=gir…
bors Jun 22, 2022
87eded6
Fix `extra_unused_lifetimes` false positive
smoelius Jun 21, 2022
1f707db
Update messages for clarity when linting
PrestonFrom Jun 23, 2022
4182803
Check for `--force-warn` in Clippy's driver run condition
xFrednet Jun 23, 2022
92704b4
Split constant check functions and simplify
Jun 23, 2022
ebf77f6
Fix ICE when deprecating lints in directories
Serial-ATA Jun 23, 2022
029f9aa
add tracking issue for exclusive
guswynn Jun 23, 2022
df26c3f
Add external macro guard and test middle MSRV
Jun 23, 2022
f718984
Auto merge of #8953 - DevAccentor:slow_vector_initialization, r=Manis…
bors Jun 23, 2022
3f47cd1
Auto merge of #9036 - xFrednet:0000-force-warn-in-driver, r=dswij
bors Jun 24, 2022
1d1ae10
Auto merge of #9037 - smoelius:fix-extra-unused-lifetimes-fp, r=dswij
bors Jun 24, 2022
a8f6824
Add test for `extra_unused_lifetimes` FP on derive
dswij Jun 24, 2022
e17864e
Auto merge of #9031 - evantypanski:manual_rem_euclid, r=Jarcho
bors Jun 24, 2022
aec465c
Add test for [`default_deprecation_reason`]
Serial-ATA Jun 24, 2022
93ebd0e
Auto merge of #9015 - kyoto7250:issue_8493, r=Jarcho
bors Jun 25, 2022
7cdaabc
Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`
Jarcho Jun 4, 2022
e7c55a4
Fix `#[expect]` for `clippy::ptr_arg`
xFrednet Jun 25, 2022
811d73a
Test `#[expect]` for `redundant_clone`
xFrednet Jun 25, 2022
a3c7101
Fix `#[expect]` for `clippy::logic_bug`
xFrednet Jun 25, 2022
b6ee6bb
Fix `#[expect]` for `clippy::nonminimal_bool`
xFrednet Jun 25, 2022
b297698
Fix `#[expect]` for `clippy::boxed_local`
xFrednet Jun 25, 2022
54ad99b
Fix `#[expect]` for `clippy::implicit_return`
xFrednet Jun 25, 2022
bdc6ece
Fix `#[expect]` for `clippy::needless_return`
xFrednet Jun 25, 2022
79fc271
Fix `#[expect]` for `unnecessary_unwrap`, `panicking_unwrap`
xFrednet Jun 25, 2022
ae4900c
Fix `#[expect]` for `clippy::macro_use_imports`
xFrednet Jun 25, 2022
525f5ee
Update `useless_attribute` docs and allow `macro_use_imports`
xFrednet Jun 25, 2022
6427ba4
Fix `#[expect]` for `clippy::manual_non_exhaustive`
xFrednet Jun 25, 2022
4d41a97
Add note to `is_lint_allowed` about lint emission
xFrednet Jun 25, 2022
3a31ef7
Give clippy some Dogfood to make it happy =^.^=
xFrednet Jun 25, 2022
8789f4e
Auto merge of #8985 - botahamec:single-match-option, r=llogiq
bors Jun 25, 2022
bf317a8
treat argument as a slice.
kyoto7250 Jun 26, 2022
d827b83
use all instead of join
kyoto7250 Jun 26, 2022
4065702
STRING_ADD example
alex-semenyuk Jun 26, 2022
1691914
STRING_ADD example
alex-semenyuk Jun 26, 2022
11bf291
update node.js version
kyoto7250 Jun 26, 2022
ab58276
Auto merge of #9055 - kyoto7250:update_nodejs_in_github_action, r=Man…
bors Jun 26, 2022
9b15062
Auto merge of #9032 - kyoto7250:issue_9018, r=llogiq
bors Jun 26, 2022
5f2b8e6
feat(new lint): new lint `use_retain`
kyoto7250 Jun 7, 2022
b20b8f1
Update clippy_lints/src/use_retain.rs
kyoto7250 Jun 9, 2022
e3afc72
remove needless return
kyoto7250 Jun 9, 2022
3953c53
change lint type from style to perf
kyoto7250 Jun 9, 2022
fd629c0
check method
kyoto7250 Jun 9, 2022
1421211
rewrite without if_chain macro
kyoto7250 Jun 9, 2022
4decfde
check msrv
kyoto7250 Jun 10, 2022
dd3d0fd
rename use_retain => manual_retain
kyoto7250 Jun 10, 2022
3a9c0ef
fix for git rebase
kyoto7250 Jun 18, 2022
676af45
cargo dev update_lints
kyoto7250 Jun 26, 2022
88da5f2
Auto merge of #8939 - Jarcho:transmute_ptr_to_ref_lt, r=giraffate
bors Jun 27, 2022
57e7e1d
Auto merge of #8871 - Serial-ATA:cargo-dev-deprecate, r=giraffate
bors Jun 27, 2022
6b762ee
Auto merge of #9054 - alex-semenyuk:string_add_example, r=giraffate
bors Jun 27, 2022
65f700f
Fix `let_undescore_lock` false-positive when binding without locking
tsoutsman Jun 13, 2022
889b361
Auto merge of #8990 - tsoutsman:master, r=llogiq
bors Jun 27, 2022
eaa03ea
Auto merge of #8972 - kyoto7250:use_retain, r=llogiq
bors Jun 27, 2022
c6a2221
Fix example `SELF_ASSIGNMENT`
alex-semenyuk Jun 25, 2022
2315f76
Actually check lifetimes in `trivially_copy_pass_by_ref`
Jarcho Apr 6, 2022
c10101c
Don't lint `trivially_copy_pass_by_ref` when unsafe pointers are used
Jarcho Apr 6, 2022
fdd0e72
Auto merge of #8649 - ebobrow:imperative_find, r=flip1995
bors Jun 27, 2022
d855395
Auto merge of #9045 - alex-semenyuk:self_assignment_example, r=llogiq
bors Jun 27, 2022
af0c1fe
fix data race in thread::scope
RalfJung Jun 25, 2022
3cfd1e5
Make messages more accurate, check lint enabled
PrestonFrom Jun 28, 2022
7bc4096
Run cargo dev fmt
PrestonFrom Jun 28, 2022
81737bf
try reading rust-version from Cargo.toml
hellow554 May 2, 2022
83511d1
update README.md to reflect rust-version in cargo.toml
hellow554 May 10, 2022
6384765
parse `Cargo.toml` file in ui-cargo tests
hellow554 Jun 27, 2022
f0a1cd5
add uitests for cargo rust-version field
hellow554 May 10, 2022
373bb57
Auto merge of #8639 - Jarcho:trivially_copy_pass_by_ref_5953, r=dswij
bors Jun 28, 2022
b776fb8
Auto merge of #8774 - hellow554:cargo-rust-version, r=flip1995
bors Jun 28, 2022
d11618e
Update `boxed_local` expect attribute location
xFrednet Jun 28, 2022
c107c97
Better support projection types when finding the signature for an exp…
Jarcho Jan 25, 2022
8a74d33
Add `explicit_auto_deref` lint
Jarcho Jan 27, 2022
ee532c0
Don't lint `explicit_auto_deref` on reborrows
Jarcho Jan 27, 2022
a187d64
Merge different parent walking loops in `dereference.rs`
Jarcho Jan 28, 2022
20ea262
Lint field accesses in `explicit_auto_deref`
Jarcho Jan 28, 2022
442a68c
Only check parent node once in `dereference.rs`
Jarcho Jan 28, 2022
65bc6cb
Lint `explicit_auto_deref` without a leading borrow
Jarcho Jan 28, 2022
0204b95
Lint `explicit_auto_deref` immediately after `needless_borrow`
Jarcho Jan 29, 2022
0b4ba73
Refactor `dereference.rs`
Jarcho Jan 29, 2022
6d21b79
Fix `needless_borrow` suggestion when calling a trait method taking `…
Jarcho Jan 30, 2022
9788107
Handle future precedence issues in `explicit_auto_deref` + cleanup
Jarcho Jan 31, 2022
15df228
Code cleanup
Jarcho Feb 7, 2022
85c1f74
Add `explicit_auto_deref` test for variadic function
Jarcho Jun 13, 2022
dd78ce7
Add `Operators` lint pass
Jarcho May 31, 2022
448b6f4
Move `Arithmetic` into `Operators` lint pass
Jarcho Jun 1, 2022
751131b
Move `AssignOps` into `Operators` lint pass
Jarcho Jun 1, 2022
68a7fd2
Move `BitMask` into `Operators` lint pass
Jarcho Jun 1, 2022
4ac3626
Move `DoubleComparison` into `Operators` lint pass
Jarcho Jun 1, 2022
732d716
Move `DurationSubsec` into `Operators` lint pass
Jarcho Jun 1, 2022
0adb3c0
Move `EqOp` into `Operators` lint pass
Jarcho Jun 1, 2022
3de70a4
Move `ErasingOp` into `Operators` lint pass
Jarcho Jun 1, 2022
56f50d3
Move `FloatEqualityWithoutAbs` into `Operators` lint pass
Jarcho Jun 1, 2022
83de67c
Move `IdentityOp` into `Operators` lint pass
Jarcho Jun 1, 2022
a8df16a
Move `IntegerDivision` into `Operators` lint pass
Jarcho Jun 1, 2022
c0b0ee5
Move some lints from `Misc` to `Operators`
Jarcho Jun 1, 2022
71c2daa
Move `ModuloArithmetic` into `Operators` lint pass
Jarcho Jun 1, 2022
fc5eac5
Move `NeedlessBitwiseBool` into `Operators` lint pass
Jarcho Jun 1, 2022
92891a0
Move `PtrEq` into `Operators` lin pass
Jarcho Jun 1, 2022
5e2a2d3
Fix dogfood
Jarcho Jun 14, 2022
ffbba85
Move `SelfAssignment` into `Operators` lint pass
Jarcho Jun 1, 2022
23c6765
Auto merge of #8921 - Jarcho:merge_passes, r=llogiq
bors Jun 28, 2022
a4130e1
Auto merge of #8355 - Jarcho:explicit_auto_deref_2, r=flip1995
bors Jun 28, 2022
4995b4e
Auto merge of #9046 - xFrednet:rust-97660-expection-something-somethi…
bors Jun 28, 2022
716af21
Factor out hir::Node::Binding
camsteffen Jun 28, 2022
27ff258
Fix height for the source sidebar in mobile mode
GuillaumeGomez Jun 29, 2022
ea97bdc
Update/add tests for source sidebar in mobile mode
GuillaumeGomez Jun 29, 2022
90227c1
Auto merge of #8981 - PrestonFrom:more_details_for_significant_drop_l…
bors Jun 29, 2022
ad970a7
Fix display of toggle on expanded source sidebar
GuillaumeGomez Jun 29, 2022
be56963
Add test for source sidebar toggle
GuillaumeGomez Jun 29, 2022
70f1d0d
Auto merge of #9043 - dswij:9037-test, r=Manishearth
bors Jun 29, 2022
58434ae
Extract util functions from `redundant_pattern_match`
Jarcho Apr 8, 2022
adbc849
Don't lint `while_let_loop` when drop order would change
Jarcho Apr 8, 2022
afd8cf2
add test for 72793
matthiaskrgr Jun 29, 2022
f60ec83
interpret: add From<&MplaceTy> for PlaceTy
RalfJung Jun 29, 2022
277b77a
Update browser-ui-test version to 0.9.7
GuillaumeGomez Jun 29, 2022
398e778
use "or pattern"
tshepang Jun 30, 2022
5d75a9b
fix
tamaroning Jun 30, 2022
88591ba
Auto merge of #8666 - Jarcho:while_let_loop_7913, r=dswij
bors Jun 30, 2022
5d9e1b6
Update large_const_arrays.rs
tamaroning Jun 30, 2022
ff3964a
Auto merge of #9068 - tamaroning:fix-typo-2022-6-30, r=giraffate,xFre…
bors Jun 30, 2022
f26cf11
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jun 30, 2022
bf9b39a
Fix dogfood
flip1995 Jun 30, 2022
d9b2e21
Bump nightly version -> 2022-06-30
flip1995 Jun 30, 2022
9de1f9f
Bump Clippy version -> 0.1.64
flip1995 Jun 30, 2022
0cb0f76
Auto merge of #9069 - flip1995:rustup, r=flip1995
bors Jun 30, 2022
721d53a
Merge commit '0cb0f7636851f9fcc57085cf80197a2ef6db098f' into clippyup
flip1995 Jun 30, 2022
5fead7a
Update Cargo.lock
flip1995 Jun 30, 2022
be580a0
Remove unneeded methods declaration for old web browsers
GuillaumeGomez Jun 30, 2022
29e0e14
rustdoc: fix 98690
pinkforest Jun 30, 2022
a3a88c7
llvm-wrapper: adapt for LLVMConstExtractValue removal
krasimirgg Jun 29, 2022
72f6322
Fix scroll when source sidebar is open on mobile
GuillaumeGomez Jun 29, 2022
9a1f52d
Add test to ensure that scroll position is kept when opening/closing …
GuillaumeGomez Jun 29, 2022
8515475
get rid of some tidy 'unnecessarily ignored' warnings
RalfJung Jun 30, 2022
15d3ea5
For diagnostic information of Boolean, remind it as use the type: 'bool'
Jun 29, 2022
0f7955e
Rollup merge of #97629 - guswynn:exclusive_struct, r=m-ou-se
matthiaskrgr Jun 30, 2022
ab4fa8a
Rollup merge of #98503 - RalfJung:scope-race, r=m-ou-se
matthiaskrgr Jun 30, 2022
1a9051e
Rollup merge of #98639 - camsteffen:no-node-binding, r=compiler-errors
matthiaskrgr Jun 30, 2022
971d08f
Rollup merge of #98670 - krasimirgg:llvm-15-LLVMConstExtractValue, r=…
matthiaskrgr Jun 30, 2022
4b7af59
Rollup merge of #98671 - GuillaumeGomez:source-sidebar-fixes, r=notri…
matthiaskrgr Jun 30, 2022
d72908b
Rollup merge of #98677 - lyming2007:issue-98492-fix, r=lcnr
matthiaskrgr Jun 30, 2022
b1ee5c7
Rollup merge of #98684 - matthiaskrgr:ice-test-72793, r=oli-obk
matthiaskrgr Jun 30, 2022
2150a48
Rollup merge of #98688 - RalfJung:from-mplace, r=oli-obk
matthiaskrgr Jun 30, 2022
54e7a63
Rollup merge of #98695 - tshepang:or-pattern, r=compiler-errors
matthiaskrgr Jun 30, 2022
f206c67
Rollup merge of #98706 - flip1995:clippyup, r=Dylan-DPC
matthiaskrgr Jun 30, 2022
94e2d07
Rollup merge of #98708 - pinkforest:rustdoc-fix-98690, r=GuillaumeGomez
matthiaskrgr Jun 30, 2022
d690171
Rollup merge of #98709 - GuillaumeGomez:rm-decl-for-old-browsers, r=D…
matthiaskrgr Jun 30, 2022
4bd8c92
Rollup merge of #98717 - RalfJung:make-tidy-less-annoying, r=jyn514
matthiaskrgr Jun 30, 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
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ dependencies = [

[[package]]
name = "clippy"
version = "0.1.63"
version = "0.1.64"
dependencies = [
"clippy_lints",
"clippy_utils",
Expand All @@ -661,6 +661,7 @@ dependencies = [
"termize",
"tester",
"tokio",
"toml",
]

[[package]]
Expand All @@ -679,10 +680,9 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.63"
version = "0.1.64"
dependencies = [
"cargo_metadata",
"clippy_dev",
"clippy_utils",
"if_chain",
"itertools",
Expand All @@ -702,7 +702,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.63"
version = "0.1.64"
dependencies = [
"arrayvec",
"if_chain",
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_ast_lowering/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
}

fn visit_pat(&mut self, pat: &'hir Pat<'hir>) {
let node =
if let PatKind::Binding(..) = pat.kind { Node::Binding(pat) } else { Node::Pat(pat) };
self.insert(pat.span, pat.hir_id, node);
self.insert(pat.span, pat.hir_id, Node::Pat(pat));

self.with_parent(pat.hir_id, |this| {
intravisit::walk_pat(this, pat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {

let upvar_hir_id = captured_place.get_root_variable();

if let Some(Node::Binding(pat)) = self.infcx.tcx.hir().find(upvar_hir_id)
if let Some(Node::Pat(pat)) = self.infcx.tcx.hir().find(upvar_hir_id)
&& let hir::PatKind::Binding(
hir::BindingAnnotation::Unannotated,
_,
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ impl<'ll> CodegenCx<'ll, '_> {
pub fn const_get_elt(&self, v: &'ll Value, idx: u64) -> &'ll Value {
unsafe {
assert_eq!(idx as c_uint as u64, idx);
let us = &[idx as c_uint];
let r = llvm::LLVMConstExtractValue(v, us.as_ptr(), us.len() as c_uint);
let r = llvm::LLVMGetAggregateElement(v, idx as c_uint).unwrap();

debug!("const_get_elt(v={:?}, idx={}, r={:?})", v, idx, r);

Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,7 @@ extern "C" {
pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
pub fn LLVMConstExtractValue(
AggConstant: &Value,
IdxList: *const c_uint,
NumIdx: c_uint,
) -> &Value;
pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;

// Operations on global variables, functions, and aliases (globals)
pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_const_eval/src/const_eval/valtrees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ fn valtree_into_mplace<'tcx>(
ty::FnDef(_, _) => {
ecx.write_immediate(
Immediate::Scalar(ScalarMaybeUninit::Scalar(Scalar::ZST)),
&(*place).into(),
&place.into(),
)
.unwrap();
}
Expand All @@ -355,7 +355,7 @@ fn valtree_into_mplace<'tcx>(
debug!("writing trivial valtree {:?} to place {:?}", scalar_int, place);
ecx.write_immediate(
Immediate::Scalar(ScalarMaybeUninit::Scalar(scalar_int.into())),
&(*place).into(),
&place.into(),
)
.unwrap();
}
Expand All @@ -382,7 +382,7 @@ fn valtree_into_mplace<'tcx>(
};
debug!(?imm);

ecx.write_immediate(imm, &(*place).into()).unwrap();
ecx.write_immediate(imm, &place.into()).unwrap();
}
ty::Adt(_, _) | ty::Tuple(_) | ty::Array(_, _) | ty::Str | ty::Slice(_) => {
let branches = valtree.unwrap_branch();
Expand Down Expand Up @@ -464,11 +464,11 @@ fn valtree_into_mplace<'tcx>(

if let Some(variant_idx) = variant_idx {
// don't forget filling the place with the discriminant of the enum
ecx.write_discriminant(variant_idx, &(*place).into()).unwrap();
ecx.write_discriminant(variant_idx, &place.into()).unwrap();
}

debug!("dump of place after writing discriminant:");
dump_place(ecx, (*place).into());
dump_place(ecx, place.into());
}
_ => bug!("shouldn't have created a ValTree for {:?}", ty),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, const_eval::Memory
let tcx = self.ecx.tcx;
let ty = mplace.layout.ty;
if let ty::Ref(_, referenced_ty, ref_mutability) = *ty.kind() {
let value = self.ecx.read_immediate(&(*mplace).into())?;
let value = self.ecx.read_immediate(&mplace.into())?;
let mplace = self.ecx.ref_to_mplace(&value)?;
assert_eq!(mplace.layout.ty, referenced_ty);
// Handle trait object vtables.
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_const_eval/src/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ impl<'tcx, Tag: Provenance> From<&'_ MPlaceTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
}
}

impl<'tcx, Tag: Provenance> From<&'_ mut MPlaceTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
#[inline(always)]
fn from(mplace: &mut MPlaceTy<'tcx, Tag>) -> Self {
OpTy { op: Operand::Indirect(**mplace), layout: mplace.layout }
}
}

impl<'tcx, Tag: Provenance> From<ImmTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
#[inline(always)]
fn from(val: ImmTy<'tcx, Tag>) -> Self {
Expand Down
16 changes: 15 additions & 1 deletion compiler/rustc_const_eval/src/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,21 @@ impl<'tcx, Tag: Provenance> std::ops::Deref for MPlaceTy<'tcx, Tag> {
impl<'tcx, Tag: Provenance> From<MPlaceTy<'tcx, Tag>> for PlaceTy<'tcx, Tag> {
#[inline(always)]
fn from(mplace: MPlaceTy<'tcx, Tag>) -> Self {
PlaceTy { place: Place::Ptr(mplace.mplace), layout: mplace.layout }
PlaceTy { place: Place::Ptr(*mplace), layout: mplace.layout }
}
}

impl<'tcx, Tag: Provenance> From<&'_ MPlaceTy<'tcx, Tag>> for PlaceTy<'tcx, Tag> {
#[inline(always)]
fn from(mplace: &MPlaceTy<'tcx, Tag>) -> Self {
PlaceTy { place: Place::Ptr(**mplace), layout: mplace.layout }
}
}

impl<'tcx, Tag: Provenance> From<&'_ mut MPlaceTy<'tcx, Tag>> for PlaceTy<'tcx, Tag> {
#[inline(always)]
fn from(mplace: &mut MPlaceTy<'tcx, Tag>) -> Self {
PlaceTy { place: Place::Ptr(**mplace), layout: mplace.layout }
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
// for a generator).
let var_hir_id = captured_place.get_root_variable();
let node = self.ecx.tcx.hir().get(var_hir_id);
if let hir::Node::Binding(pat) = node {
if let hir::Node::Pat(pat) = node {
if let hir::PatKind::Binding(_, _, ident, _) = pat.kind {
name = Some(ident.name);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/interpret/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M>
&self,
_ecx: &InterpCx<'mir, 'tcx, M>,
) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>> {
Ok((*self).into())
Ok(self.into())
}

#[inline(always)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ impl HandlerInner {
self.flags.treat_err_as_bug.map(|c| c.get()).unwrap_or(0),
) {
(1, 1) => panic!("aborting due to `-Z treat-err-as-bug=1`"),
(0, _) | (1, _) => {}
(0 | 1, _) => {}
(count, as_bug) => panic!(
"aborting after {} errors due to `-Z treat-err-as-bug={}`",
count, as_bug,
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3326,7 +3326,6 @@ pub enum Node<'hir> {
Ty(&'hir Ty<'hir>),
TypeBinding(&'hir TypeBinding<'hir>),
TraitRef(&'hir TraitRef<'hir>),
Binding(&'hir Pat<'hir>),
Pat(&'hir Pat<'hir>),
Arm(&'hir Arm<'hir>),
Block(&'hir Block<'hir>),
Expand Down Expand Up @@ -3378,7 +3377,6 @@ impl<'hir> Node<'hir> {
| Node::Block(..)
| Node::Ctor(..)
| Node::Pat(..)
| Node::Binding(..)
| Node::Arm(..)
| Node::Local(..)
| Node::Crate(..)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<'a> State<'a> {
Node::Ty(a) => self.print_type(&a),
Node::TypeBinding(a) => self.print_type_binding(&a),
Node::TraitRef(a) => self.print_trait_ref(&a),
Node::Binding(a) | Node::Pat(a) => self.print_pat(&a),
Node::Pat(a) => self.print_pat(&a),
Node::Arm(a) => self.print_arm(&a),
Node::Infer(_) => self.word("_"),
Node::Block(a) => {
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1865,3 +1865,11 @@ extern "C" void LLVMRustGetMangledName(LLVMValueRef V, RustStringRef Str) {
GlobalValue *GV = unwrap<GlobalValue>(V);
Mangler().getNameWithPrefix(OS, GV, true);
}

// LLVMGetAggregateElement was added in LLVM 15. For earlier LLVM versions just
// use its implementation.
#if LLVM_VERSION_LT(15, 0)
extern "C" LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx) {
return wrap(unwrap<Constant>(C)->getAggregateElement(Idx));
}
#endif
5 changes: 1 addition & 4 deletions compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ impl<'hir> Map<'hir> {
| Node::Infer(_)
| Node::TraitRef(_)
| Node::Pat(_)
| Node::Binding(_)
| Node::Local(_)
| Node::Param(_)
| Node::Arm(_)
Expand Down Expand Up @@ -901,7 +900,7 @@ impl<'hir> Map<'hir> {
#[inline]
fn opt_ident(self, id: HirId) -> Option<Ident> {
match self.get(id) {
Node::Binding(&Pat { kind: PatKind::Binding(_, _, ident, _), .. }) => Some(ident),
Node::Pat(&Pat { kind: PatKind::Binding(_, _, ident, _), .. }) => Some(ident),
// A `Ctor` doesn't have an identifier itself, but its parent
// struct/variant does. Compare with `hir::Map::opt_span`.
Node::Ctor(..) => match self.find(self.get_parent_node(id))? {
Expand Down Expand Up @@ -969,7 +968,6 @@ impl<'hir> Map<'hir> {
Node::Ty(ty) => ty.span,
Node::TypeBinding(tb) => tb.span,
Node::TraitRef(tr) => tr.path.span,
Node::Binding(pat) => pat.span,
Node::Pat(pat) => pat.span,
Node::Arm(arm) => arm.span,
Node::Block(block) => block.span,
Expand Down Expand Up @@ -1203,7 +1201,6 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String {
Some(Node::Ty(_)) => node_str("type"),
Some(Node::TypeBinding(_)) => node_str("type binding"),
Some(Node::TraitRef(_)) => node_str("trait ref"),
Some(Node::Binding(_)) => node_str("local"),
Some(Node::Pat(_)) => node_str("pat"),
Some(Node::Param(_)) => node_str("param"),
Some(Node::Arm(_)) => node_str("arm"),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
continue;
};
let pat = match tcx.hir().get(arg.pat.hir_id) {
Node::Pat(pat) | Node::Binding(pat) => pat,
Node::Pat(pat) => pat,
node => bug!("pattern became {:?}", node),
};
let pattern = pat_from_hir(tcx, self.param_env, self.typeck_results, pat);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/thir/cx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<'tcx> Cx<'tcx> {
#[tracing::instrument(level = "debug", skip(self))]
pub(crate) fn pattern_from_hir(&mut self, p: &hir::Pat<'_>) -> Pat<'tcx> {
let p = match self.tcx.hir().get(p.hir_id) {
Node::Pat(p) | Node::Binding(p) => p,
Node::Pat(p) => p,
node => bug!("pattern became {:?}", node),
};
pat_from_hir(self.tcx, self.param_env, self.typeck_results(), p)
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,8 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
Some(match name {
"byte" => sym::u8, // In Java, bytes are signed, but in practice one almost always wants unsigned bytes.
"short" => sym::i16,
"Bool" => sym::bool,
"Boolean" => sym::bool,
"boolean" => sym::bool,
"int" => sym::i32,
"long" => sym::i64,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_save_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,9 @@ impl<'tcx> SaveContext<'tcx> {
}
},

Node::Binding(&hir::Pat {
kind: hir::PatKind::Binding(_, canonical_id, ..), ..
}) => Res::Local(canonical_id),
Node::Pat(&hir::Pat { kind: hir::PatKind::Binding(_, canonical_id, ..), .. }) => {
Res::Local(canonical_id)
}

_ => Res::Err,
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
None,
hir::Path { res: hir::def::Res::Local(hir_id), .. },
)) => {
if let Some(hir::Node::Binding(pat)) = self.tcx.hir().find(*hir_id) {
if let Some(hir::Node::Pat(pat)) = self.tcx.hir().find(*hir_id) {
let parent = self.tcx.hir().get_parent_node(pat.hir_id);
primary_span = pat.span;
secondary_span = pat.span;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ impl<'a, 'tcx> DropRangeVisitor<'a, 'tcx> {
| hir::Node::Ty(..)
| hir::Node::TypeBinding(..)
| hir::Node::TraitRef(..)
| hir::Node::Binding(..)
| hir::Node::Pat(..)
| hir::Node::Arm(..)
| hir::Node::Local(..)
Expand Down
Loading