Commit Graph

219218 Commits

Author SHA1 Message Date
Matthias Krüger
76994625f8
Rollup merge of #108930 - Ezrashaw:better-error-for-manual-fn-impl, r=petrochenkov
feat: implement better error for manual impl of `Fn*` traits

Fixes #39259

cc `@estebank` (you gave me some advice in the linked issue, would you like to review?)
2023-03-10 19:59:19 +01:00
Matthias Krüger
4ad32304c7
Rollup merge of #108900 - bvanjoi:issue-108275, r=petrochenkov
fix(lexer): print whitespace warning for \x0c

- close https://github.com/rust-lang/rust/issues/108275
- discussion: https://github.com/rust-lang/rust/pull/108403
2023-03-10 19:59:19 +01:00
Matthias Krüger
bee84733ad
Rollup merge of #108834 - compiler-errors:fn-ptr-fn-obl, r=spastorino
Do not ICE when we have fn pointer `Fn` obligations with bound vars in the self type

We never supported solving `for<'a> fn(&'a ()): Fn(&'a ())` -- I tried to add that support in #104929, but iirc `@lcnr` wanted to support this more generally by eagerly instantiating trait predicate binders with placeholders. That never happened due to blockers in the old solver, but we probably shouldn't ICE in any case.

On the bright side, this passes on the new solver :^)
2023-03-10 19:59:18 +01:00
Matthias Krüger
233ed35e84
Rollup merge of #108828 - compiler-errors:new-solver-alias-eq-on-num-var, r=lcnr
Emit alias-eq when equating numeric var and projection

This doesn't fix everything having to do with projections and infer vars, but it does fix a common case I saw in HIR typeck.

r? `@lcnr`
2023-03-10 19:59:18 +01:00
Matthias Krüger
b90277e37b
Rollup merge of #106921 - madsmtm:cell-memory-layout, r=dtolnay
Add documentation about the memory layout of `Cell`

https://github.com/rust-lang/rust/pull/101717 guaranteed the memory layout of `UnsafeCell<T>`.

This property (a guaranteed memory layout) can be useful to have on `Cell<T>` as well.

(Note that `Cell<u8>` [already doesn't trigger the `improper_ctypes` lint](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=34af59ef60b96d8a8bdaec1d52cb5420) since it is `#[repr(transparent)]`).

The concrete use-case is for the crate [`objc2`](https://github.com/madsmtm/objc2) to specify that `Cell<T>` is safe to use as an instance variable when `T` is.

Fixes https://github.com/rust-lang/rust/issues/79303.

---

I'm unsure if we should specify less, for example say that the `Cell` may have extra restrictions on when it may be accessed, or if that's implicit in the (deliberately minimal) way I've worded it here?
2023-03-10 19:59:17 +01:00
bors
35a0961bbc Auto merge of #108977 - matthiaskrgr:rollup-1bnl1hu, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108879 (Unconstrained terms should account for infer vars being equated)
 - #108936 (Rustdoc: don't hide anonymous reexport)
 - #108940 (Add myself to compiler reviewers list)
 - #108945 (Make some report and emit errors take DefIds instead of BodyIds)
 - #108946 (Document the resulting values produced when using `From<bool>` on floats)
 - #108956 (Make ptr::from_ref and ptr::from_mut in #106116 const.)
 - #108960 (Remove `body_def_id` from `Inherited`)
 - #108963 (only call git on git checkouts during bootstrap)
 - #108964 (Fix the docs for pointer method with_metadata_of)

Failed merges:

 - #108950 (Directly construct Inherited in typeck.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-10 15:39:25 +00:00
bors
d5833423a0 Auto merge of #102256 - cjgillot:let-under, r=lcnr
Introduce a no-op `PlaceMention` statement for `let _ =`.

Fixes https://github.com/rust-lang/rust/issues/54003
Fixes https://github.com/rust-lang/rust/issues/80059
Split from https://github.com/rust-lang/rust/pull/101500

This PR introduces a new `PlaceMention` statement dedicated to matches that neither introduce bindings nor ascribe types.  Without this, all traces of the match would vanish from MIR, making it impossible to diagnose unsafety or use in #101500.

This allows to mark `let _ = <unsafe union access or dereference>` as requiring an unsafe block.
Nominating for lang team, as this introduces an extra error.
2023-03-10 11:55:59 +00:00
Matthias Krüger
df74b70b9e
Rollup merge of #108964 - majaha:ptr_metadata_doc, r=workingjubilee
Fix the docs for pointer method with_metadata_of

The name of the argument to `{*const T, *mut T}::with_metadata_of` was changed from `val` to `meta` recently, but the docs weren't updated to match.

Relevant pull request: #103701
2023-03-10 12:32:02 +01:00
Matthias Krüger
7918df5f57
Rollup merge of #108963 - jhheider:fix-CI-non-git-builds, r=albertlarsan68
only call git on git checkouts during bootstrap

fixes https://github.com/rust-lang/rust/issues/108959
2023-03-10 12:32:02 +01:00
Matthias Krüger
671339cdb0
Rollup merge of #108960 - compiler-errors:no-body-def-id, r=cjgillot
Remove `body_def_id` from `Inherited`

We can just use the body id from the obligation cause.

Follow-up to #108945, only my commit is relevant.

r? `@cjgillot` cc `@spastorino`
2023-03-10 12:32:01 +01:00
Matthias Krüger
65db3cb794
Rollup merge of #108956 - Raekye:master, r=scottmcm
Make ptr::from_ref and ptr::from_mut in #106116 const.

As per https://github.com/rust-lang/rust/issues/106116#issuecomment-1462571833
2023-03-10 12:32:01 +01:00
Matthias Krüger
e0c8ba1929
Rollup merge of #108946 - bmoxb:bool-to-float-docs, r=cuviper
Document the resulting values produced when using `From<bool>` on floats

Have the documentation of the implementation of `From<bool>` on `f32` and `f64` indicate the output values (`0.0` for `false` and `1.0` for `true`).

closes #108939
2023-03-10 12:32:00 +01:00
Matthias Krüger
afd8558d62
Rollup merge of #108945 - spastorino:pass-def-id-instead-of-using-hir-id, r=compiler-errors
Make some report and emit errors take DefIds instead of BodyIds

Breaking off from #108915

r? `@compiler-errors`
2023-03-10 12:31:59 +01:00
Matthias Krüger
63c6a341f5
Rollup merge of #108940 - b-naber:reviewers-list, r=compiler-errors
Add myself to compiler reviewers list
2023-03-10 12:31:59 +01:00
Matthias Krüger
6ef07c2df1
Rollup merge of #108936 - GuillaumeGomez:rustdoc-anonymous-reexport, r=notriddle
Rustdoc: don't hide anonymous reexport

Fixes https://github.com/rust-lang/rust/issues/108931.

From https://github.com/rust-lang/rust/issues/108931, it appears that having anonymous re-exports for traits is actually used in some places, so instead of hiding them automatically, we should prevent them to be ever inlined.

r? `@notriddle`
2023-03-10 12:31:58 +01:00
Matthias Krüger
4bd32ac31d
Rollup merge of #108879 - compiler-errors:constrained-root-var, r=lcnr
Unconstrained terms should account for infer vars being equated

Follow-up from the canonicalization PR, wanted to break this one out so I can approve the other PR.

r? `@lcnr`
2023-03-10 12:31:58 +01:00
bors
104f4300cf Auto merge of #108934 - matthiaskrgr:rollup-vm414p5, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #106915 (Only load one CSS theme by default)
 - #108294 (Place binder correctly for arbitrary trait bound suggestion)
 - #108778 (x fmt: Don't print all modified files if there's more than 10)
 - #108854 (feat/refactor: improve errors in case of ident with number at start)
 - #108870 (Fix invalid inlining of reexport of reexport of private item)
 - #108917 (Consider target_family as pal)
 - #108922 (Add auto notification for changes to stable mir)
 - #108929 (Fix typo in span_map.rs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-10 08:09:25 +00:00
Ezra Shaw
a30c2c26c0
feat: implement better error for manual impl of Fn* traits 2023-03-10 20:32:24 +13:00
Michael Goulet
a8f905cdd9 Unconstrained terms should account for infer vars being equated 2023-03-10 04:08:09 +00:00
bors
f37f854994 Auto merge of #108951 - cuviper:solaris-debs, r=Mark-Simulacrum
ci: use `apt install --download-only` for solaris debs
2023-03-10 03:23:00 +00:00
Matt Harding
ccb552e4f5 Fix docs for ptr method with_metadata_of() 2023-03-10 02:14:09 +00:00
Jacob Heider
54e5c19f08
only call git on git checkouts 2023-03-09 20:15:40 -05:00
Michael Goulet
fd34549686 Remove body_def_id from Inherited 2023-03-09 23:25:23 +00:00
Raekye
e8fbf6205e Make ptr::from_ref and ptr::from_mut in #106116 const. 2023-03-09 16:36:20 -05:00
Santiago Pastorino
5b99723439
Make some report and emit errors take DefIds instead of BodyIds 2023-03-09 17:53:35 -03:00
bmoxb
b439189236 Add examples section which demonstrates the behaviour (specifically the sign positive aspect) 2023-03-09 20:44:11 +00:00
bmoxb
8d2bdb89c6 Add missing comment for f64 2023-03-09 20:37:04 +00:00
bmoxb
73016bb8d4 Indicate that 0.0 refers to positive 0.0 2023-03-09 20:36:29 +00:00
Josh Stone
258c7e73c4 ci: use apt install --download-only for solaris debs 2023-03-09 12:23:18 -08:00
bmoxb
d5bb6056f1 Document the resulting values produced when using From<bool> on floats 2023-03-09 18:55:33 +00:00
Camille GILLOT
684de0418f Update coverage info. 2023-03-09 17:51:38 +00:00
Camille GILLOT
2eccd52157 Test let _ = for const_mut_refs. 2023-03-09 17:45:13 +00:00
Camille GILLOT
09dc10c9c2 Bug on PlaceMention in dest-prop. 2023-03-09 17:45:13 +00:00
Camille GILLOT
45f2a1af3b Document borrowck behaviour. 2023-03-09 17:45:13 +00:00
Camille GILLOT
b34a8a294d Pacify tidy. 2023-03-09 17:45:13 +00:00
Camille GILLOT
a5ef6bac28 Also test destructuring assignment. 2023-03-09 17:45:13 +00:00
Camille GILLOT
e107194b66 Ignore AscribeUserType in unsafeck to avoid duplicate diagnostics. 2023-03-09 17:45:13 +00:00
Camille GILLOT
4462bb54e3 Introduce a no-op PlaceMention statement for let _ =. 2023-03-09 17:45:13 +00:00
Camille GILLOT
be758ef5ab Add ui test. 2023-03-09 17:45:13 +00:00
Michael Goulet
d4b59a0da2 Propagate expected return type instead of real return type in check_binop 2023-03-09 17:24:07 +00:00
Michael Goulet
1b6d6f92d1 Fix canonicalizer bug for int/float vars too 2023-03-09 17:24:07 +00:00
Guillaume Gomez
9b788da2da Update rustdoc anonymous reexport test and add regression test for #108931 2023-03-09 18:08:22 +01:00
Guillaume Gomez
e8bd4ef1e5 Don't hide anonymous re-exports but never inline them 2023-03-09 18:08:22 +01:00
Michael Goulet
3aea46979a Emit alias-eq when equating numeric var and projection 2023-03-09 16:42:56 +00:00
b-naber
c6d32f4b05 add myself to compiler reviewers list 2023-03-09 16:10:24 +00:00
bohan
d223c26bce fix(lexer): not skipped whitespace warning for '\x0c' 2023-03-09 22:44:58 +08:00
Matthias Krüger
5b3f84d8af
Rollup merge of #108929 - eltociear:patch-20, r=GuillaumeGomez
Fix typo in span_map.rs

correspondance -> correspondence
2023-03-09 12:11:55 +01:00
Matthias Krüger
ceff836bfe
Rollup merge of #108922 - celinval:stable-mir-bot, r=oli-obk
Add auto notification for changes to stable mir

Adds a new entry to the triagebot configuration file to notify subscribers about changes to the stable MIR. I added myself and `@oli-obk` for now.

r?oli-obk
2023-03-09 12:11:55 +01:00
Matthias Krüger
972ea7fd84
Rollup merge of #108917 - Ayush1325:tidy-improve, r=workingjubilee
Consider target_family as pal

Currently, tidy does not consider code in target_family as platform-specific. This is erroneous and should be fixed.

r? `@workingjubilee`
2023-03-09 12:11:54 +01:00
Matthias Krüger
506495a4b3
Rollup merge of #108870 - GuillaumeGomez:rustdoc-reexport-of-reexport-of-private, r=notriddle
Fix invalid inlining of reexport of reexport of private item

Fixes https://github.com/rust-lang/rust/issues/108679.

The problem is that a reexport is always resolving to the end type, so if the end type is private, the reexport inlines. Except that if you reexport a public reexport (which reexports the private item), then it should not be inlined again.

r? `@notriddle`
2023-03-09 12:11:54 +01:00