Skip to content
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

Relate existential associated types with variance Invariant #71896

Merged
merged 1 commit into from
Jun 11, 2020

Conversation

spastorino
Copy link
Member

@spastorino spastorino commented May 4, 2020

Fixes #71550 #72315

r? @nikomatsakis

The test case reported in that issue now errors with the following message ...

error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in function call due to conflicting requirements
  --> /tmp/test.rs:25:5
   |
25 |     bad(&Bar(PhantomData), x)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:11...
  --> /tmp/test.rs:24:11
   |
24 | fn extend<'a, T>(x: &'a T) -> &'static T {
   |           ^^
note: ...so that reference does not outlive borrowed content
  --> /tmp/test.rs:25:28
   |
25 |     bad(&Bar(PhantomData), x)
   |                            ^
   = note: but, the lifetime must be valid for the static lifetime...
note: ...so that the types are compatible
  --> /tmp/test.rs:25:9
   |
25 |     bad(&Bar(PhantomData), x)
   |         ^^^^^^^^^^^^^^^^^
   = note: expected  `&'static T`
              found  `&T`

error: aborting due to previous error

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

I could also add that test case if we want to have a weaponized one too.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 4, 2020
@spastorino spastorino force-pushed the existential-assoc-types-variance branch from c06d4ae to b3099be Compare May 4, 2020 20:42
@nikomatsakis
Copy link
Contributor

It seems certainly possible that this will cause regressions in people's code on crater. I wonder if a crater run is appropriate, or if we should just move forward.

@Mark-Simulacrum -- weren't you saying that the crater queue is very long at present?

@spastorino spastorino force-pushed the existential-assoc-types-variance branch from b3099be to 4a376a9 Compare May 4, 2020 21:06
@spastorino
Copy link
Member Author

Just pushed some minor stderr files fixes.

@nikomatsakis
Copy link
Contributor

r=me but the only question is whether we should do a crater run -- see zulip topic

@Mark-Simulacrum
Copy link
Member

@bors try

Let's prepare a try build for a potential crater run

@bors
Copy link
Contributor

bors commented May 6, 2020

⌛ Trying commit 4a376a9ca7c5c0d6f3bb12ef241ace06641963f9 with merge 96b3c169cd2d8959926fa240f10342f1659f8ae3...

@bors
Copy link
Contributor

bors commented May 6, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: 96b3c169cd2d8959926fa240f10342f1659f8ae3 (96b3c169cd2d8959926fa240f10342f1659f8ae3)

@Mark-Simulacrum
Copy link
Member

@craterbot check p=1

@craterbot
Copy link
Collaborator

👌 Experiment pr-71896 created and queued.
🤖 Automatically detected try build 96b3c169cd2d8959926fa240f10342f1659f8ae3
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 6, 2020
@craterbot
Copy link
Collaborator

🚧 Experiment pr-71896 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🚨 Experiment pr-71896 has encountered an error: some threads returned an error
🛠️ If the error is fixed use the retry command.

🆘 Can someone from the infra team check in on this? @rust-lang/infra
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@Mark-Simulacrum
Copy link
Member

@craterbot retry

I can't find anything in logs...

@craterbot
Copy link
Collaborator

🛠️ Experiment pr-71896 queued again.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🚧 Experiment pr-71896 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-71896 is completed!
📊 21 regressed and 1 fixed (103152 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels May 10, 2020
@bjorn3
Copy link
Member

bjorn3 commented May 11, 2020

Spurious

  • Ziqul.vulkano-training.5e4a0f210c93c69cc7a6741ba09aa4c9bcadec9e
  • denoland.rusty_v8.36bec8cd2ba766b9428cc0fb3f2038863e7c21ff
  • electron-0.1.0
  • radish-database-0.1.0
  • rusty_v8-0.4.1

Regressions

  • ezksd.combinator.a2989e2e8fc92c9c8b1b4c949d9d8cc0b4de1986
  • githubaccount624.rocket-rooms.181ae13300244f79e7295eff84b3d07f7b28bdd5
  • gribbet.rust_api_example.6c2086f619b7e3f591cae6a7aa1deed91a504824
  • mich101mich.game_rs.f5e2796d3f8437e9630777e745ed7b8b2a513d30
  • spacemeowx2.slp-server-rust.2aaf02c7f0a352c6c826c45b6f12f5978604b089
  • sstanfield.slsh.b3068a910f91a5bd35b2e2b61a18b5ea18071785
  • attr-0.1.0
  • dcmdump-0.1.0
  • dicom-object-0.1.0
    • dicom-0.1.0
  • happy-0.1.1
  • symbolic-debuginfo-7.3.0
    • getsentry.sentry-cli.121f1b75e468f21378b2993e369b762f2c05ddf1
    • mozilla.dump_syms.2603fb01a18e4e11d95b95fc08d9dacad9076f43
    • symbolic-minidump-7.3.0
    • symbolic-7.3.0

@nikomatsakis
Copy link
Contributor

Fewer regressions that I feared, though more than I would like. =)

@nikomatsakis
Copy link
Contributor

So I'm pondering a few things:

  • We could plausibly try to accept this code.
  • We could plausible try a future-compatibility warning, but I don't quite know how to do that.
  • We could ping crate authors and try to land this change.

@bors
Copy link
Contributor

bors commented Jun 10, 2020

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 10, 2020
@nikomatsakis
Copy link
Contributor

Uh...

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 10, 2020
@bors
Copy link
Contributor

bors commented Jun 10, 2020

⌛ Testing commit c99164e with merge f33d195b1d8402ecdbbc7492d2b9fc61868f0c9e...

@Dylan-DPC-zz
Copy link

@bors retry yield

@bors
Copy link
Contributor

bors commented Jun 10, 2020

⌛ Testing commit c99164e with merge 3d9aab01630687424b650880ce3cbc1338c2ce02...

@bors
Copy link
Contributor

bors commented Jun 10, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 10, 2020
@nikomatsakis
Copy link
Contributor

I failed somehow to find the logs in that output above... what the heck =)

@spastorino
Copy link
Member Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 11, 2020
@bors
Copy link
Contributor

bors commented Jun 11, 2020

⌛ Testing commit c99164e with merge 3ddf480...

@bors
Copy link
Contributor

bors commented Jun 11, 2020

☀️ Test successful - checks-azure
Approved by: nikomatsakis
Pushing 3ddf480 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 11, 2020
@bors bors merged commit 3ddf480 into rust-lang:master Jun 11, 2020
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 30, 2020
according to various people on tech-pkg@, there are no problems with
the Firefox build

Version 1.46.0 (2020-08-27)
==========================

Language
--------
- [`if`, `match`, and `loop` expressions can now be used in const functions.][72437]
- [Additionally you are now also able to coerce and cast to slices (`&[T]`) in
  const functions.][73862]
- [The `#[track_caller]` attribute can now be added to functions to use the
  function's caller's location information for panic messages.][72445]
- [Recursively indexing into tuples no longer needs parentheses.][71322] E.g.
  `x.0.0` over `(x.0).0`.
- [`mem::transmute` can now be used in static and constants.][72920] **Note**
  You currently can't use `mem::transmute` in constant functions.

Compiler
--------
- [You can now use the `cdylib` target on Apple iOS and tvOS platforms.][73516]
- [Enabled static "Position Independent Executables" by default
  for `x86_64-unknown-linux-musl`.][70740]

Libraries
---------
- [`mem::forget` is now a `const fn`.][73887]
- [`String` now implements `From<char>`.][73466]
- [The `leading_ones`, and `trailing_ones` methods have been stabilised for all
  integer types.][73032]
- [`vec::IntoIter<T>` now implements `AsRef<[T]>`.][72583]
- [All non-zero integer types (`NonZeroU8`) now implement `TryFrom` for their
  zero-able equivalent (e.g. `TryFrom<u8>`).][72717]
- [`&[T]` and `&mut [T]` now implement `PartialEq<Vec<T>>`.][71660]
- [`(String, u16)` now implements `ToSocketAddrs`.][73007]
- [`vec::Drain<'_, T>` now implements `AsRef<[T]>`.][72584]

Stabilized APIs
---------------
- [`Option::zip`]
- [`vec::Drain::as_slice`]

Cargo
-----
Added a number of new environment variables that are now available when
compiling your crate.

- [`CARGO_BIN_NAME` and `CARGO_CRATE_NAME`][cargo/8270] Providing the name of
  the specific binary being compiled and the name of the crate.
- [`CARGO_PKG_LICENSE`][cargo/8325] The license from the manifest of the package.
- [`CARGO_PKG_LICENSE_FILE`][cargo/8387] The path to the license file.

Compatibility Notes
-------------------
- [The target configuration option `abi_blacklist` has been renamed
  to `unsupported_abis`.][74150] The old name will still continue to work.
- [Rustc will now warn if you cast a C-like enum that implements `Drop`.][72331]
  This was previously accepted but will become a hard error in a future release.
- [Rustc will fail to compile if you have a struct with
  `#[repr(i128)]` or `#[repr(u128)]`.][74109] This representation is currently only
  allowed on `enum`s.
- [Tokens passed to `macro_rules!` are now always captured.][73293] This helps
  ensure that spans have the correct information, and may cause breakage if you
  were relying on receiving spans with dummy information.
- [The InnoSetup installer for Windows is no longer available.][72569] This was
  a legacy installer that was replaced by a MSI installer a few years ago but
  was still being built.
- [`{f32, f64}::asinh` now returns the correct values for negative numbers.][72486]
- [Rustc will no longer accept overlapping trait implementations that only
  differ in how the lifetime was bound.][72493]
- [Rustc now correctly relates the lifetime of an existential associated
  type.][71896] This fixes some edge cases where `rustc` would erroneously allow
  you to pass a shorter lifetime than expected.
- [Rustc now dynamically links to `libz` (also called `zlib`) on Linux.][74420]
  The library will need to be installed for `rustc` to work, even though we
  expect it to be already available on most systems.
- [Tests annotated with `#[should_panic]` are broken on ARMv7 while running
  under QEMU.][74820]
- [Pretty printing of some tokens in procedural macros changed.][75453] The
  exact output returned by rustc's pretty printing is an unstable
  implementation detail: we recommend any macro relying on it to switch to a
  more robust parsing system.

[75453]: rust-lang/rust#75453
[74820]: rust-lang/rust#74820
[74420]: rust-lang/rust#74420
[74109]: rust-lang/rust#74109
[74150]: rust-lang/rust#74150
[73862]: rust-lang/rust#73862
[73887]: rust-lang/rust#73887
[73466]: rust-lang/rust#73466
[73516]: rust-lang/rust#73516
[73293]: rust-lang/rust#73293
[73007]: rust-lang/rust#73007
[73032]: rust-lang/rust#73032
[72920]: rust-lang/rust#72920
[72569]: rust-lang/rust#72569
[72583]: rust-lang/rust#72583
[72584]: rust-lang/rust#72584
[72717]: rust-lang/rust#72717
[72437]: rust-lang/rust#72437
[72445]: rust-lang/rust#72445
[72486]: rust-lang/rust#72486
[72493]: rust-lang/rust#72493
[72331]: rust-lang/rust#72331
[71896]: rust-lang/rust#71896
[71660]: rust-lang/rust#71660
[71322]: rust-lang/rust#71322
[70740]: rust-lang/rust#70740
[cargo/8270]: rust-lang/cargo#8270
[cargo/8325]: rust-lang/cargo#8325
[cargo/8387]: rust-lang/cargo#8387
[`Option::zip`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.zip
[`vec::Drain::as_slice`]: https://doc.rust-lang.org/stable/std/vec/struct.Drain.html#method.as_slice
@coolreader18
Copy link
Contributor

coolreader18 commented Sep 1, 2020

Here's a piece of code that broke with this:

fn c_string_array_to_rust<'a>(
    arr: *const *const ::std::os::raw::c_char,
    count: usize,
) -> Box<dyn Iterator<Item = &'a str>> {
    //assert!(!arr.is_null());
    if arr.is_null() {
        Box::new(iter::empty::<&'a str>())
        // ~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements [E0495]
    } else {
        let slice_of_pointers = unsafe { slice::from_raw_parts(arr, count) };
        Box::new(
            slice_of_pointers.iter()
                .map(|s| unsafe { CStr::from_ptr(*s) }.to_str().unwrap()),
        )
    }
}

I'm pretty sure this is sound? Since iter::empty never actually produces a value of its T

full message:

error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
  --> src/discovery.rs:76:18
   |
76 |         Box::new(iter::empty::<&'a str>())
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 70:27...
  --> src/discovery.rs:70:27
   |
70 | fn c_string_array_to_rust<'a>(
   |                           ^^
note: ...so that the expression is assignable
  --> src/discovery.rs:76:18
   |
76 |         Box::new(iter::empty::<&'a str>())
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^
   = note: expected `std::iter::Empty<&str>`
              found `std::iter::Empty<&'a str>`
   = note: but, the lifetime must be valid for the static lifetime...
note: ...so that the expression is assignable
  --> src/discovery.rs:76:9
   |
76 |         Box::new(iter::empty::<&'a str>())
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &'a str> + 'static)>`
              found `std::boxed::Box<dyn std::iter::Iterator<Item = &'a str>>`

@kennytm
Copy link
Member

kennytm commented Sep 1, 2020

@coolreader18 try using Box<dyn Iterator<Item = &'a str> + 'a> as the return type of c_string_array_to_rust?

@coolreader18
Copy link
Contributor

I resolved it another way, just wanted to bring this to attention. Thanks for the suggestion though @kennytm, that does fix it as well.

@nikomatsakis
Copy link
Contributor

Just to clarify the problem:

This is expected. The cause is the same as I explained for ezksd.combinator. In fact, i'm going to inline the hackmd for posterity's sake, since it has a lot more detailed that never made it into a github comment.

regressions for #71896

Crater report: https://crater-reports.s3.amazonaws.com/pr-71896/index.html

summary

package sound-ish? trait
ezksd dyn Parser<Input = X>, but interacts with outlives
rocket-rooms ✔️ response::ResultFuture<'r>
gribbet.rust_api_example ✔️ ResultFuture<'static>
mich101mich.game_rs ✔️ Iterator
spacemeowx2.slp-server-rust ✔️ dyn Stream
sstanfield.slsh ✔️ dyn Iterator
attr-1.0 🤷 unclear
dcmdump-0.1.0 🤷 unclear
dicom-object-0.1.0 🤷 unclear, same as previous?
happy-0.1.0 dyn Parser<Input = X>, maybe interacts with outlives
symbolic-debuginfo-7.3.0 ✔️ dyn Iterator

Key:

  • ✔️ -- "straightforwardly sound"
  • ❌ -- not sound
  • 🤷 didn't quite figure it out yet

ezksd.combinator.a2989e2e8fc92c9c8b1b4c949d9d8cc0b4de1986

This one is tricky. The actual interaction of subtyping is unsound. The code is
relying on Box<dyn Parser<Input = &'static str>> being a subtype of Box<dyn Parser<Input = &'a str>>, which is incorrect, as Self::Input appears in a
contravariant position. In other words, effectively, given a fn that requires
'static inputs, we are "upcasting" it to a fn that takes any input.

However, the tricky bit is in the reason that a Box<dyn Parser<Input = &'static str>>
type is required in the first place. This comes about because there is a type like
so used in the flat_map combinator:

Box<dyn Parser<Input = &'a str, ...>>

The problem here is that there is an implicit bound of Box<dyn Parser<..> + 'static> going on. The underlying type in this case is something like
Empty<&'? str>, where the '? is an inference variable. Because of our
outlives rules, that '? gets inferred to 'static. The clincher is that the
Empty types does't actually contain any data, it's just holding types. We
don't really have a good way to express this today given Rust's outlives rules.

Moreover, if we used the invariant rule that this PR puts in place, but we had better
outlives rules, then the code would be accepted.

githubaccount624.rocket-rooms.181ae13300244f79e7295eff84b3d07f7b28bdd5

The actual error occurs in rocket, which is a dependency of rocket-rooms:

https://github.com/SergioBenitez/Rocket/blob/e7afd0d1f464b85392051be3a2f382185960ccb8/core/lib/src/response/responder.rs#L218

The relevant code is:

pub trait Responder<'r> {
    fn respond_to(self, request: &'r Request<'_>) -> response::ResultFuture<'r>;
}


impl Responder<'_> for String {
    fn respond_to(self, _: &Request<'_>) -> response::ResultFuture<'static> {
        Box::pin(async move {
            Response::build()
                .header(ContentType::Plain)
                .sized_body(Cursor::new(self))
                .ok()
        })
    }
}

The subtyping is occuring in a covariant position (the return type), so accepting response::ResultFuture<'static> <: response::ResultFuture<'r> would be sound if we inferred the variance instead of using Invariant.

gribbet.rust_api_example.6c2086f619b7e3f591cae6a7aa1deed91a504824

The errors are ResultFuture<'static> -- the associated type in future is an output that appears in covariant position.

mich101mich.game_rs.f5e2796d3f8437e9630777e745ed7b8b2a513d30

Box<dyn Iterator<Item = T>>, as above

spacemeowx2.slp-server-rust.2aaf02c7f0a352c6c826c45b6f12f5978604b089

Not a root regression, but related to dyn futures::Stream<Item = GraphQLResponse<'a, S>
Not a root regression, but it looks like maybe this comes from Future? Related to juniper_subscriptions

https://github.com/spacemeowx2/juniper/blob/95686b7ce530538d14bd42aafd47e07989dc9c2a/juniper_subscriptions/src/lib.rs#L149
log

sstanfield.slsh.b3068a910f91a5bd35b2e2b61a18b5ea18071785

Box<dyn Iterator<Item = &Expression>>

attr-0.1.0

Not totally sure what's going on here but I think it's related to Box<dyn Iterator<...>> and the implicit 'static bound. The error occurs in a test:

[INFO] [stderr] error[E0597]: `path` does not live long enough
[INFO] [stderr]    --> tests/mapping.rs:197:18
[INFO] [stderr]     |
[INFO] [stderr] 197 |     let result = path.traverse(&top).unwrap().map(std::result::Result::unwrap).collect::<Vec<_>>();
[INFO] [stderr]     |                  ^^^^---------------
[INFO] [stderr]     |                  |
[INFO] [stderr]     |                  borrowed value does not live long enough
[INFO] [stderr]     |                  argument requires that `path` is borrowed for `'static`
[INFO] [stderr] 198 |     assert_eq!(result, vec!["foo", "bla"]);
[INFO] [stderr] 199 | }
[INFO] [stderr]     | - `path` dropped here while still borrowed

dcmdump-0.1.0

Not very clear

[INFO] [stderr] error[E0310]: the parameter type `S` may not live long enough
[INFO] [stderr]    --> /opt/rustwide/cargo-home/registry/src/git.luolix.top-1ecc6299db9ec823/dicom-object-0.1.0/src/mem.rs:183:18
[INFO] [stderr]     |
[INFO] [stderr] 166 |     pub fn from_reader_with_dict<S>(src: S, dict: D) -> Result<Self>
[INFO] [stderr]     |                                  - help: consider adding an explicit lifetime bound...: `S: 'static`
[INFO] [stderr] ...
[INFO] [stderr] 183 |             obj: InMemDicomObject::build_object(&mut dataset, dict, false, Length::UNDEFINED)?,
[INFO] [stderr]     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr]     |
[INFO] [stderr] note: ...so that the type `std::io::BufReader<S>` will meet its required lifetime bounds
[INFO] [stderr]    --> /opt/rustwide/cargo-home/registry/src/git.luolix.top-1ecc6299db9ec823/dicom-object-0.1.0/src/mem.rs:183:18
[INFO] [stderr]     |
[INFO] [stderr] 183 |             obj: InMemDicomObject::build_object(&mut dataset, dict, false, Length::UNDEFINED)?,
[INFO] [stderr]     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stderr] 
[INFO] [stderr] error: aborting due to previous error

happy

really derives from a use of combine v2.4.0:

[INFO] [stderr] error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
[INFO] [stderr]   --> src/parse_route.rs:86:26
[INFO] [stderr]    |
[INFO] [stderr] 86 |     optional(token('/')).and(many1(segment())).map(|(_, v)| v).boxed()
[INFO] [stderr]    |                          ^^^
[INFO] [stderr]    |
[INFO] [stderr] note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 85:8...
[INFO] [stderr]   --> src/parse_route.rs:85:8
[INFO] [stderr]    |
[INFO] [stderr] 85 | fn url<'a>() -> Box<StrParser<'a, Vec<Segment>>> {
[INFO] [stderr]    |        ^^
type StrParser<'a, R> = combine::Parser<Output=R, Input=&'a str>;

looks unsound given Parser trait, possibly a similar pattern to the first

symbolic-debuginfo-7.3.0

 DynIterator<'_, Symbol<'_>>

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Oct 30, 2020
Pkgsrc changes:
 * Portability patches for Illumos have been intregrated upstream,
   so are no longer needed in pkgsrc.
 * Adjust one other patch, and update vendor/libc cargo checksum.

Upstream changes:

Version 1.46.0 (2020-08-27)
==========================

Language
--------
- [`if`, `match`, and `loop` expressions can now be used in const functions.]
  [72437]
- [Additionally you are now also able to coerce and cast to slices (`&[T]`) in
  const functions.][73862]
- [The `#[track_caller]` attribute can now be added to functions to use the
  function's caller's location information for panic messages.][72445]
- [Recursively indexing into tuples no longer needs parentheses.][71322] E.g.
  `x.0.0` over `(x.0).0`.
- [`mem::transmute` can now be used in static and constants.][72920] **Note**
  You currently can't use `mem::transmute` in constant functions.

Compiler
--------
- [You can now use the `cdylib` target on Apple iOS and tvOS platforms.][73516]
- [Enabled static "Position Independent Executables" by default
  for `x86_64-unknown-linux-musl`.][70740]

Libraries
---------
- [`mem::forget` is now a `const fn`.][73887]
- [`String` now implements `From<char>`.][73466]
- [The `leading_ones`, and `trailing_ones` methods have been stabilised for all
  integer types.][73032]
- [`vec::IntoIter<T>` now implements `AsRef<[T]>`.][72583]
- [All non-zero integer types (`NonZeroU8`) now implement `TryFrom` for their
  zero-able equivalent (e.g. `TryFrom<u8>`).][72717]
- [`&[T]` and `&mut [T]` now implement `PartialEq<Vec<T>>`.][71660]
- [`(String, u16)` now implements `ToSocketAddrs`.][73007]
- [`vec::Drain<'_, T>` now implements `AsRef<[T]>`.][72584]

Stabilized APIs
---------------
- [`Option::zip`]
- [`vec::Drain::as_slice`]

Cargo
-----
Added a number of new environment variables that are now available when
compiling your crate.

- [`CARGO_BIN_NAME` and `CARGO_CRATE_NAME`][cargo/8270] Providing the name of
  the specific binary being compiled and the name of the crate.
- [`CARGO_PKG_LICENSE`][cargo/8325] The license from the manifest of the
  package.
- [`CARGO_PKG_LICENSE_FILE`][cargo/8387] The path to the license file.

Compatibility Notes
-------------------
- [The target configuration option `abi_blacklist` has been renamed
  to `unsupported_abis`.][74150] The old name will still continue to work.
- [Rustc will now warn if you have a C-like enum that implements `Drop`.][72331]
  This was previously accepted but will become a hard error in a future release.
- [Rustc will fail to compile if you have a struct with
  `#[repr(i128)]` or `#[repr(u128)]`.][74109] This representation is currently
  only allowed on `enum`s.
- [Tokens passed to `macro_rules!` are now always captured.][73293] This helps
  ensure that spans have the correct information, and may cause breakage if you
  were relying on receiving spans with dummy information.
- [The InnoSetup installer for Windows is no longer available.][72569] This was
  a legacy installer that was replaced by a MSI installer a few years ago but
  was still being built.
- [`{f32, f64}::asinh` now returns the correct values for negative numbers.]
  [72486]
- [Rustc will no longer accept overlapping trait implementations that only
  differ in how the lifetime was bound.][72493]
- [Rustc now correctly relates the lifetime of an existential associated
  type.][71896] This fixes some edge cases where `rustc` would erroneously
  allow you to pass a shorter lifetime than expected.
- [Rustc now dynamically links to `libz` (also called `zlib`) on Linux.][74420]
  The library will need to be installed for `rustc` to work, even though we
  expect it to be already available on most systems.
- [Tests annotated with `#[should_panic]` are broken on ARMv7 while running
  under QEMU.][74820]
- [Pretty printing of some tokens in procedural macros changed.][75453] The
  exact output returned by rustc's pretty printing is an unstable
  implementation detail: we recommend any macro relying on it to switch to a
  more robust parsing system.

[75453]: rust-lang/rust#75453
[74820]: rust-lang/rust#74820
[74420]: rust-lang/rust#74420
[74109]: rust-lang/rust#74109
[74150]: rust-lang/rust#74150
[73862]: rust-lang/rust#73862
[73887]: rust-lang/rust#73887
[73466]: rust-lang/rust#73466
[73516]: rust-lang/rust#73516
[73293]: rust-lang/rust#73293
[73007]: rust-lang/rust#73007
[73032]: rust-lang/rust#73032
[72920]: rust-lang/rust#72920
[72569]: rust-lang/rust#72569
[72583]: rust-lang/rust#72583
[72584]: rust-lang/rust#72584
[72717]: rust-lang/rust#72717
[72437]: rust-lang/rust#72437
[72445]: rust-lang/rust#72445
[72486]: rust-lang/rust#72486
[72493]: rust-lang/rust#72493
[72331]: rust-lang/rust#72331
[71896]: rust-lang/rust#71896
[71660]: rust-lang/rust#71660
[71322]: rust-lang/rust#71322
[70740]: rust-lang/rust#70740
[cargo/8270]: rust-lang/cargo#8270
[cargo/8325]: rust-lang/cargo#8325
[cargo/8387]: rust-lang/cargo#8387
[`Option::zip`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.zip
[`vec::Drain::as_slice`]: https://doc.rust-lang.org/stable/std/vec/struct.Drain.html#method.as_slice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unsoundness due to variance of trait objects WRT associated types