Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5055864
disable NLL liveness optimization when using polonius
lqd Dec 30, 2024
0c978bc
introduce reachability to the constraint graph
lqd Dec 31, 2024
67a1bb1
replace location-insensitive analysis with location-sensitive analysis
lqd Dec 31, 2024
550cf1f
handle kills in reachability
lqd Dec 31, 2024
0f3dd33
deal with naive reachability weakness
lqd Dec 31, 2024
735013d
remove location-insensitive ICE test
lqd Dec 31, 2024
8ac045d
move out of scope precomputer code
lqd Jan 10, 2025
5cdb029
Introduce a test for the `i128` calling convention on Windows
tgross35 Dec 14, 2024
f78a1bd
Detect if-else chains with a missing final else in type errors
estebank Jan 15, 2025
2f13d43
Windows x86: Change `i128` to return via the vector ABI
tgross35 Dec 14, 2024
9397d13
Treat other items as functions for the purpose of type-based search
lolbinarycat Jan 13, 2025
08c1256
fix error for when results in a rustdoc-js test are in the wrong order
lolbinarycat Jan 16, 2025
8d59545
Fix suggestion to convert dereference of raw pointer to ref
samueltardieu Jan 15, 2025
9bdc658
Expand docs for `E0207` with additional example
estebank Jan 16, 2025
11a8cd3
Rollup merge of #131806 - lolbinarycat:rustdoc-search-all-is-func, r=…
matthiaskrgr Jan 17, 2025
89d1865
Rollup merge of #134290 - tgross35:windows-i128-callconv, r=bjorn3,we…
matthiaskrgr Jan 17, 2025
e5cd0c5
Rollup merge of #134980 - lqd:polonius-next-episode-7, r=jackh726
matthiaskrgr Jan 17, 2025
f477eca
Rollup merge of #135558 - estebank:issue-133316, r=chenyukang
matthiaskrgr Jan 17, 2025
e348172
Rollup merge of #135594 - lolbinarycat:tester.js-order-error, r=notri…
matthiaskrgr Jan 17, 2025
a5ca2a0
Rollup merge of #135601 - samueltardieu:push-xslotxrnooym, r=jieyouxu
matthiaskrgr Jan 17, 2025
479e0c1
Rollup merge of #135604 - estebank:docs-e0207, r=jieyouxu
matthiaskrgr Jan 17, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2682,6 +2682,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

if let hir::ExprKind::Unary(hir::UnOp::Deref, inner) = expr.kind
&& let Some(1) = self.deref_steps_for_suggestion(expected, checked_ty)
&& self.typeck_results.borrow().expr_ty(inner).is_ref()
{
// We have `*&T`, check if what was expected was `&T`.
// If so, we may want to suggest removing a `*`.
Expand Down
19 changes: 19 additions & 0 deletions tests/ui/suggestions/raw-to-ref.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ run-rustfix
// Regression test for #135580: check that we do not suggest to simply drop
// the `*` to make the types match when the source is a raw pointer while
// the target type is a reference.

struct S;

fn main() {
let mut s = S;
let x = &raw const s;
let _: &S = unsafe { &*x };
//~^ ERROR mismatched types
//~| HELP consider borrowing here

let x = &raw mut s;
let _: &mut S = unsafe { &mut *x };
//~^ ERROR mismatched types
//~| HELP consider mutably borrowing here
}
19 changes: 19 additions & 0 deletions tests/ui/suggestions/raw-to-ref.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ run-rustfix
// Regression test for #135580: check that we do not suggest to simply drop
// the `*` to make the types match when the source is a raw pointer while
// the target type is a reference.

struct S;

fn main() {
let mut s = S;
let x = &raw const s;
let _: &S = unsafe { *x };
//~^ ERROR mismatched types
//~| HELP consider borrowing here

let x = &raw mut s;
let _: &mut S = unsafe { *x };
//~^ ERROR mismatched types
//~| HELP consider mutably borrowing here
}
25 changes: 25 additions & 0 deletions tests/ui/suggestions/raw-to-ref.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error[E0308]: mismatched types
--> $DIR/raw-to-ref.rs:11:26
|
LL | let _: &S = unsafe { *x };
| ^^ expected `&S`, found `S`
|
help: consider borrowing here
|
LL | let _: &S = unsafe { &*x };
| +

error[E0308]: mismatched types
--> $DIR/raw-to-ref.rs:16:30
|
LL | let _: &mut S = unsafe { *x };
| ^^ expected `&mut S`, found `S`
|
help: consider mutably borrowing here
|
LL | let _: &mut S = unsafe { &mut *x };
| ++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.