Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
aef3d93
Add powerpc64-ibm-aix as Tier-3 target
ecnelises Aug 25, 2022
83701f5
Use ObligationCtxt intead of dyn TraitEngine
spastorino Nov 16, 2022
23422a8
Call fully_solve_obligations instead of repeating code
spastorino Nov 17, 2022
9864a63
Pass ObligationCtxt from enter_canonical_trait_query and use Obligati…
spastorino Nov 16, 2022
4e9ceef
Refactor `must_use` lint into two parts
Noratrieb Nov 13, 2022
644a5a3
enable fuzzy_provenance_casts lint in liballoc
RalfJung Nov 20, 2022
7f5addd
enable fuzzy_provenance_casts lint in libstd
RalfJung Nov 20, 2022
1a69666
dont attempt strict provenance in SGX
RalfJung Nov 21, 2022
2752e32
Allow opaque types in trait impl headers and rely on coherence to rej…
oli-obk Oct 24, 2022
94fe30f
Treat different opaque types of the same def id as equal during coher…
oli-obk Oct 27, 2022
ae80c76
Add an always-ambiguous predicate to make sure that we don't accident…
oli-obk Nov 2, 2022
9cd44f8
nit treat different opaque types
oli-obk Nov 14, 2022
9a8e1ee
Move a field around
oli-obk Nov 14, 2022
f42e490
Register obligations from type relation
oli-obk Nov 14, 2022
11ae334
Remove a function that doesn't actually do anything
oli-obk Nov 15, 2022
7301cd7
Type generalization should not look at opaque type in coherence
oli-obk Nov 17, 2022
11adf03
Add some more assertions for type relations not used during coherence
oli-obk Nov 17, 2022
c16a90f
Test generalization during coherence
oli-obk Nov 17, 2022
98cb7c8
Suggest `.clone()` or `ref binding` on E0382
estebank Nov 3, 2022
fface0c
Do not suggest `ref` multiple times for the same binding
estebank Nov 3, 2022
cca960d
Fix clippy code
estebank Nov 3, 2022
242dd83
Use `type_implements_trait`
estebank Nov 3, 2022
e88009b
Extract suggestion logic to its own method
estebank Nov 3, 2022
0994f8d
Remove logic duplication
estebank Nov 3, 2022
4918d4f
Tweak output in for loops
estebank Nov 3, 2022
33a6dc9
Fix wording
estebank Nov 3, 2022
6f77be4
Fix rustfmt
estebank Nov 3, 2022
a930d44
Tweak output to account for alternative bindings in the same pattern
estebank Nov 3, 2022
5bf1413
Fix rebase
estebank Nov 3, 2022
95a5beb
remove spurious commented out code
estebank Nov 4, 2022
2698d24
review comments: inline bindings and fix typo
estebank Nov 12, 2022
9a39012
Account for `x @ y` and suggest `ref x @ ref y`
estebank Nov 15, 2022
7cc4fb5
Account for closures
estebank Nov 16, 2022
3099dfd
Forbid inlining `thread_local!`'s `__getit` function on Windows
thomcc Sep 3, 2022
2d5d692
Add failing test for projections used as const generic
GuillaumeGomez Nov 22, 2022
04610ad
Fix `ClosureKind::to_def_id`
WaffleLapkin Nov 22, 2022
b80356a
Use `tcx.require_lang_item` instead of unwrapping
WaffleLapkin Nov 22, 2022
f2830f2
Speed up mpsc_stress test
Nov 22, 2022
90e8b94
Rollup merge of #101368 - thomcc:wintls-noinline, r=ChrisDenton
Manishearth Nov 22, 2022
ab6f755
Rollup merge of #102293 - ecnelises:aix.initial, r=davidtwco
Manishearth Nov 22, 2022
43eb708
Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
Manishearth Nov 22, 2022
b3a2eea
Rollup merge of #103908 - estebank:consider-cloning, r=compiler-errors
Manishearth Nov 22, 2022
1e12a3a
Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead
Manishearth Nov 22, 2022
bbe1843
Rollup merge of #104509 - spastorino:use-obligation-ctxt, r=lcnr
Manishearth Nov 22, 2022
7c56974
Rollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomcc
Manishearth Nov 22, 2022
e105d05
Rollup merge of #104717 - GuillaumeGomez:test-projection-used-as-cons…
Manishearth Nov 22, 2022
60a07e1
Rollup merge of #104722 - mejrs:stress, r=ChrisDenton
Manishearth Nov 22, 2022
2078dbd
Rollup merge of #104724 - WaffleLapkin:to_def_idn't, r=compiler-errors
Manishearth Nov 22, 2022
0c626d4
Rollup merge of #104728 - WaffleLapkin:require-lang-items-politely, r…
Manishearth Nov 22, 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
Prev Previous commit
Next Next commit
review comments: inline bindings and fix typo
  • Loading branch information
estebank committed Nov 21, 2022
commit 2698d245d1581579cd75f14c274d54829bb8f6f2
14 changes: 9 additions & 5 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let tcx = self.infcx.tcx;
// Try to find predicates on *generic params* that would allow copying `ty`
let infcx = tcx.infer_ctxt().build();
let clone_did = tcx.lang_items().clone_trait().unwrap();
let params = ty::List::empty();
let ty = tcx.erase_regions(ty);
let env = self.param_env;
if infcx.type_implements_trait(clone_did, ty, params, env).must_apply_modulo_regions() {
if infcx
.type_implements_trait(
tcx.lang_items().clone_trait().unwrap(),
tcx.erase_regions(ty),
ty::List::empty(),
self.param_env,
)
.must_apply_modulo_regions()
{
err.span_suggestion_verbose(
span.shrink_to_hi(),
"consider cloning the value if the performance cost is acceptable",
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | consume(b);
LL | consume(b);
| ^ value used here after move
|
note: consider changing this parameter type in function `consume` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `consume` to borrow instead if owning the value isn't necessary
--> $DIR/borrowck-consume-unsize-vec.rs:3:15
|
LL | fn consume(_: Box<[i32]>) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-consume-upcast-box.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | consume(b);
LL | consume(b);
| ^ value used here after move
|
note: consider changing this parameter type in function `consume` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `consume` to borrow instead if owning the value isn't necessary
--> $DIR/borrowck-consume-upcast-box.rs:5:15
|
LL | fn consume(_: Box<dyn Foo>) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/mut-borrow-in-loop-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | for _ in 0..3 {
LL | Other::handle(value);
| ^^^^^ value moved here, in previous iteration of loop
|
note: consider changing this parameter type in function `handle` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `handle` to borrow instead if owning the value isn't necessary
--> $DIR/mut-borrow-in-loop-2.rs:9:22
|
LL | fn handle(value: T) -> Self;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/liveness/liveness-move-call-arg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | loop {
LL | take(x);
| ^ value moved here, in previous iteration of loop
|
note: consider changing this parameter type in function `take` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `take` to borrow instead if owning the value isn't necessary
--> $DIR/liveness-move-call-arg.rs:1:13
|
LL | fn take(_x: Box<isize>) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/liveness/liveness-use-after-send.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | send(ch, message);
LL | println!("{}", message);
| ^^^^^^^ value borrowed here after move
|
note: consider changing this parameter type in function `send` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `send` to borrow instead if owning the value isn't necessary
--> $DIR/liveness-use-after-send.rs:3:54
|
LL | fn send<T:Send + std::fmt::Debug>(ch: Chan<T>, data: T) {
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/moves/borrow-closures-instead-of-move.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | loop {
LL | takes_fnonce(f);
| ^ value moved here, in previous iteration of loop
|
note: consider changing this parameter type in function `takes_fnonce` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `takes_fnonce` to borrow instead if owning the value isn't necessary
--> $DIR/borrow-closures-instead-of-move.rs:34:20
|
LL | fn takes_fnonce(_: impl FnOnce()) {}
Expand All @@ -32,7 +32,7 @@ LL | takes_fnonce(m);
LL | takes_fnonce(m);
| ^ value used here after move
|
note: consider changing this parameter type in function `takes_fnonce` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `takes_fnonce` to borrow instead if owning the value isn't necessary
--> $DIR/borrow-closures-instead-of-move.rs:34:20
|
LL | fn takes_fnonce(_: impl FnOnce()) {}
Expand All @@ -58,7 +58,7 @@ note: closure cannot be moved more than once as it is not `Copy` due to moving t
|
LL | x += 1;
| ^
note: consider changing this parameter type in function `takes_fnonce` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `takes_fnonce` to borrow instead if owning the value isn't necessary
--> $DIR/borrow-closures-instead-of-move.rs:34:20
|
LL | fn takes_fnonce(_: impl FnOnce()) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/moves/move-guard-same-consts.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | (1, 2) if take(x) => (),
LL | (1, 2) if take(x) => (),
| ^ value used here after move
|
note: consider changing this parameter type in function `take` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `take` to borrow instead if owning the value isn't necessary
--> $DIR/move-guard-same-consts.rs:25:15
|
LL | fn take<T>(_: T) -> bool { false }
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/moves/move-in-guard-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | (1, _) if take(x) => (),
LL | (_, 2) if take(x) => (),
| ^ value used here after move
|
note: consider changing this parameter type in function `take` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `take` to borrow instead if owning the value isn't necessary
--> $DIR/move-in-guard-1.rs:15:15
|
LL | fn take<T>(_: T) -> bool { false }
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/moves/move-in-guard-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | let x: Box<_> = Box::new(1);
LL | (_, 2) if take(x) => (),
| ^ value used here after move
|
note: consider changing this parameter type in function `take` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `take` to borrow instead if owning the value isn't necessary
--> $DIR/move-in-guard-2.rs:13:15
|
LL | fn take<T>(_: T) -> bool { false }
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/moves/moves-based-on-type-exprs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ LL | _ if guard(x) => 10,
LL | touch(&x);
| ^^ value borrowed here after move
|
note: consider changing this parameter type in function `guard` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `guard` to borrow instead if owning the value isn't necessary
--> $DIR/moves-based-on-type-exprs.rs:6:14
|
LL | fn guard(_s: String) -> bool {panic!()}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/union/union-move.mirunsafeck.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | move_out(x.f1_nocopy);
LL | move_out(x.f2_nocopy);
| ^^^^^^^^^^^ value used here after move
|
note: consider changing this parameter type in function `move_out` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary
--> $DIR/union-move.rs:10:19
|
LL | fn move_out<T>(x: T) {}
Expand All @@ -28,7 +28,7 @@ LL | move_out(x.f2_nocopy);
LL | move_out(x.f3_copy);
| ^^^^^^^^^ value used here after move
|
note: consider changing this parameter type in function `move_out` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary
--> $DIR/union-move.rs:10:19
|
LL | fn move_out<T>(x: T) {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/union/union-move.thirunsafeck.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | move_out(x.f1_nocopy);
LL | move_out(x.f2_nocopy);
| ^^^^^^^^^^^ value used here after move
|
note: consider changing this parameter type in function `move_out` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary
--> $DIR/union-move.rs:10:19
|
LL | fn move_out<T>(x: T) {}
Expand All @@ -28,7 +28,7 @@ LL | move_out(x.f2_nocopy);
LL | move_out(x.f3_copy);
| ^^^^^^^^^ value used here after move
|
note: consider changing this parameter type in function `move_out` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `move_out` to borrow instead if owning the value isn't necessary
--> $DIR/union-move.rs:10:19
|
LL | fn move_out<T>(x: T) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unsized-locals/borrow-after-move.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ LL | drop_unsized(y);
LL | println!("{}", &y);
| ^^ value borrowed here after move
|
note: consider changing this parameter type in function `drop_unsized` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `drop_unsized` to borrow instead if owning the value isn't necessary
--> $DIR/borrow-after-move.rs:14:31
|
LL | fn drop_unsized<T: ?Sized>(_: T) {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unsized-locals/double-move.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LL | drop_unsized(y);
LL | drop_unsized(y);
| ^ value used here after move
|
note: consider changing this parameter type in function `drop_unsized` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in function `drop_unsized` to borrow instead if owning the value isn't necessary
--> $DIR/double-move.rs:14:31
|
LL | fn drop_unsized<T: ?Sized>(_: T) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL |
LL | let x = n.to_string();
| ^^^^^^^^^^^^^ value borrowed here after move
|
note: consider changing this parameter type in method `push` to borrow instead if ownering the value isn't necessary
note: consider changing this parameter type in method `push` to borrow instead if owning the value isn't necessary
--> $DIR/use-after-move-implicity-coerced-object.rs:17:27
|
LL | fn push(&mut self, n: Box<dyn ToString + 'static>) {
Expand Down