rust/tests
bors ed49386d3a Auto merge of #136539 - matthewjasper:late-normalize-errors, r=compiler-errors
Emit dropck normalization errors in borrowck

Borrowck generally assumes that any queries it runs for type checking will succeed, thinking that HIR typeck will have errored first if there was a problem. However as of #98641, dropck isn't run on HIR, so there's no direct guarantee that it doesn't error. While a type being well-formed might be expected to ensure that its fields are well-formed, this is not the case for types containing a type projection:

```rust
pub trait AuthUser {
    type Id;
}

pub trait AuthnBackend {
    type User: AuthUser;
}

pub struct AuthSession<Backend: AuthnBackend> {
    data: Option<<<Backend as AuthnBackend>::User as AuthUser>::Id>,
}

pub trait Authz: Sized {
    type AuthnBackend: AuthnBackend<User = Self>;
}

pub fn run_query<User: Authz>(auth: AuthSession<User::AuthnBackend>) {}
// ^ No User: AuthUser bound is required or inferred.
```

While improvements to trait solving might fix this in the future, for now we go for a pragmatic solution of emitting an error from borrowck (by rerunning dropck outside of a query) and making drop elaboration check if an error has been emitted previously before panicking for a failed normalization.

Closes #103899
Closes #135039

r? `@compiler-errors` (feel free to re-assign)
2025-02-19 07:49:08 +00:00
..
assembly x86-sse2 ABI: use SSE registers for floats and SIMD 2025-02-18 16:11:41 +01:00
auxiliary use add-core-stubs / minicore for a few more tests 2025-02-16 18:37:50 +01:00
codegen Auto merge of #135408 - RalfJung:x86-sse2, r=workingjubilee 2025-02-19 01:25:01 +00:00
codegen-units Remove -Zinline-in-all-cgus and clean up CGU partitioning tests 2025-01-27 23:48:47 -05:00
coverage coverage: Eliminate more counters by giving them to unreachable nodes 2025-02-13 13:45:53 +11:00
coverage-run-rustdoc
crashes Update tests for dropck normalization errors 2025-02-17 11:33:07 +00:00
debuginfo
incremental tests: error strings for ABI stability now match 2025-02-09 20:45:47 -08:00
mir-opt Use MirPatch in EnumSizeOpt. 2025-02-18 12:52:56 +11:00
pretty
run-make Rollup merge of #137095 - saethlin:use-hash64-for-hashes, r=workingjubilee 2025-02-17 06:38:14 +01:00
rustdoc Add regression test for source line numbers 2025-02-11 14:29:58 +01:00
rustdoc-gui rustdoc: use better, consistent SVG icons for scraped examples 2025-02-12 16:07:11 -07:00
rustdoc-js
rustdoc-js-std Remove the common prelude module 2025-02-11 13:04:27 -08:00
rustdoc-json Add missing lang items in no_core tests in rustdoc 2025-02-04 01:05:31 +00:00
rustdoc-ui Rollup merge of #137120 - ChrisDenton:its-all-relative, r=GuillaumeGomez 2025-02-17 06:38:15 +01:00
ui Auto merge of #136539 - matthewjasper:late-normalize-errors, r=compiler-errors 2025-02-19 07:49:08 +00:00
ui-fulldeps Auto merge of #137164 - matthiaskrgr:rollup-dj5826k, r=matthiaskrgr 2025-02-17 11:18:33 +00:00
COMPILER_TESTS.md