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

Rollup of 2 pull requests #114234

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 29 additions & 2 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use rustc_hir::LangItem;
use rustc_session::config::TrimmedDefPaths;
use rustc_session::cstore::{ExternCrate, ExternCrateSource};
use rustc_session::Limit;
use rustc_span::sym;
use rustc_span::symbol::{kw, Ident, Symbol};
use rustc_span::FileNameDisplayPreference;
use rustc_target::abi::Size;
Expand Down Expand Up @@ -2017,11 +2018,37 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
) -> Result<Self::Path, Self::Error> {
self = print_prefix(self)?;

if args.first().is_some() {
let tcx = self.tcx;

let args = args.iter().copied();

let args: Vec<_> = if !tcx.sess.verbose() {
// skip host param as those are printed as `~const`
args.filter(|arg| match arg.unpack() {
// FIXME(effects) there should be a better way than just matching the name
GenericArgKind::Const(c)
if tcx.features().effects
&& matches!(
c.kind(),
ty::ConstKind::Param(ty::ParamConst { name: sym::host, .. })
) =>
{
false
}
_ => true,
})
.collect()
} else {
// If -Zverbose is passed, we should print the host parameter instead
// of eating it.
args.collect()
};

if !args.is_empty() {
if self.in_value {
write!(self, "::")?;
}
self.generic_delimiters(|cx| cx.comma_sep(args.iter().cloned()))
self.generic_delimiters(|cx| cx.comma_sep(args.into_iter()))
} else {
Ok(self)
}
Expand Down
8 changes: 8 additions & 0 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2543,6 +2543,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
/// let cursor = a.lower_bound(Bound::Included(&2));
/// assert_eq!(cursor.key(), Some(&2));
/// let cursor = a.lower_bound(Bound::Excluded(&2));
/// assert_eq!(cursor.key(), Some(&3));
/// ```
Expand Down Expand Up @@ -2582,6 +2584,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
/// let cursor = a.lower_bound_mut(Bound::Included(&2));
/// assert_eq!(cursor.key(), Some(&2));
/// let cursor = a.lower_bound_mut(Bound::Excluded(&2));
/// assert_eq!(cursor.key(), Some(&3));
/// ```
Expand Down Expand Up @@ -2634,6 +2638,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
/// let cursor = a.upper_bound(Bound::Included(&3));
/// assert_eq!(cursor.key(), Some(&3));
/// let cursor = a.upper_bound(Bound::Excluded(&3));
/// assert_eq!(cursor.key(), Some(&2));
/// ```
Expand Down Expand Up @@ -2673,6 +2679,8 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
/// a.insert(2, "b");
/// a.insert(3, "c");
/// a.insert(4, "c");
/// let cursor = a.upper_bound_mut(Bound::Included(&3));
/// assert_eq!(cursor.key(), Some(&3));
/// let cursor = a.upper_bound_mut(Bound::Excluded(&3));
/// assert_eq!(cursor.key(), Some(&2));
/// ```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// known-bug: #110395
#![feature(const_trait_impl)]
#![feature(const_trait_impl, effects)]

#[const_trait]
pub trait Tr {
fn a(&self) {}

fn b(&self) {
().a()
//FIXME ~^ ERROR the trait bound
//~^ ERROR the trait bound
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0015]: cannot call non-const fn `<() as Tr>::a` in constant functions
--> $DIR/default-method-body-is-const-same-trait-ck.rs:9:12
error[E0277]: the trait bound `(): ~const Tr` is not satisfied
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
LL | ().a()
| ^^^
| ^ the trait `~const Tr` is not implemented for `()`
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= help: the trait `Tr` is implemented for `()`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0015`.
For more information about this error, try `rustc --explain E0277`.
Loading